WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Change redirect…

[Resolved] Change redirect…

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author ArrayHQ
    Member

    @okaythemes

    Hi Stu,
    If the form submits successfully, the URL string gets a sent=1 parameter. You can detect this with JS and then scroll to the anchor where your form is.

    Add this to your theme’s JS and replace #your-anchor with whatever you have your subscribe form wrapped in.

    
    // Scroll to element on div
    if(window.location.href.indexOf("sent=1") > -1) {
    	$('html, body').animate({
            scrollTop: $("#your-anchor").offset().top
        }, 300);
    }
    
    

    I added:

    <script type="text/javascript">
    // Scroll to element on div
    if(window.location.href.indexOf("sent=1") > -1) {
    	$('html, body').animate({
            scrollTop: $("#beta-signup").offset().top
        }, 300);
    }
       </script>

    to header.php

    doesn’t seem to work

    I tried adding just the JS to the main.js but that isn’t working either.

    Website: http://getdistilld.com/
    Theme: Agile-WP

    Plugin Contributor John Parris
    Participant

    @mindctrl

    Hey Stu,

    Try this in your header (changing the two $ to jQuery):

    <script type="text/javascript">
    if(window.location.href.indexOf("sent=1") > -1) {
    	jQuery('html, body').animate({
            scrollTop: jQuery("#beta-signup").offset().top
        }, 300);
    }
    </script>

    I tested this in my browser dev tool and it seems to work ok. Let us know.

    hmm still not working

    I used a different form plugin that doesn’t refresh and uses ajax instead. Thanks anyway!

    Romeo Crow
    Member

    @romeo-crow

    How/where can I edit the actual code of the plugin to add my own redirect URL, instead of the sent=1 parameter?

    (I don’t want it staying on the same page)

    It would be great if a future update of the plugin had “Redirect URL” as an editable field in the plugin options.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] Change redirect…’ is closed to new replies.