Plugin Author
ArrayHQ
(@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);
}
Thread Starter
edtstu
(@edtstu)
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
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.
Thread Starter
edtstu
(@edtstu)
I used a different form plugin that doesn’t refresh and uses ajax instead. Thanks anyway!
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.