Hi @klaggy,
Hope this message finds you well.
I visited your site and the code seems to be working, also the provided code didn’t require updating the form ID it will get it from the same code.
Could you try in incognito or private mode, and let us know, please?
Best regards,
Laura
Thread Starter
klaggy
(@klaggy)
Oh, interesting, so it does work when we click on “Next” and “Previous” but it doesn’t when you click directly on the “1-5”, “6-10” which is how I was testing. As you’ll see that way of navigating doesn’t work…
Hello @klaggy,
Hope you’re doing great today!
In order to make it trigger the same function when clicking on the numbers, could you please try adding the following code on a new line, right before the closing </script>
tag:
jQuery('.forminator-step').on('click', function( e ) {
jQuery("html, body").stop();
var scrolltop = jQuery('.forminator-pagination').offset().top;
jQuery("html, body").animate({ scrollTop: scrolltop + 200 }, 500);
});
Let us know if there’s still any issue.
Best Regards,
Dmytro
Thread Starter
klaggy
(@klaggy)
Thank you for your quick response but that didn’t work unfortunately.
Hi @klaggy
Please try slightly different version of the code. Here is an entire code to test:
<?php
add_action('wp_footer', 'forminator_scroll_top_script', 9999);
function forminator_scroll_top_script()
{
global $post;
if (is_a($post, 'WP_Post') && !has_shortcode($post->post_content, 'forminator_form')) {
return;
}
?>
<script type="text/javascript">
jQuery('#forminator-module-3010').find('.forminator-button-next').on('click', function(){
jQuery("html, body").stop();
var scrolltop = jQuery('.forminator-pagination').offset().top;
jQuery("html, body").animate({ scrollTop: scrolltop + 200 }, 500);
});
jQuery('#forminator-module-3010').find('.forminator-button-back').on('click', function(){
jQuery("html, body").stop();
var scrolltop = jQuery('.forminator-pagination').offset().top;
jQuery("html, body").animate({ scrollTop: scrolltop + 200 }, 500);
});
jQuery( document ).on( 'forminator.front.pagination.move', function( e ) {
jQuery("html, body").stop();
var scrolltop = jQuery('.forminator-pagination').offset().top;
jQuery("html, body").animate({ scrollTop: scrolltop + 200 }, 500);
});
jQuery('.forminator-step').on('click', function( e ) {
jQuery("html, body").stop();
var scrolltop = jQuery('.forminator-pagination').offset().top;
jQuery("html, body").animate({ scrollTop: scrolltop + 200 }, 500);
});
</script>
<?php
}
– don’t add it to existing code but instead replace entire code in your MU plugin with above one
– and replace both occurrences of number 3010 in it with your form ID
There is only a slight difference comparing to original one but this version seems to be working fine on my end – reacting to clicks on both next/prev buttions and paging.
Also: in case it still didn’t work, try switching form between “Load form using AJAX” option enabled vs disabled in form’s “Behavior” settings.
Kind regards,
Adam
Thread Starter
klaggy
(@klaggy)
Thanks for this new code, tried it, same thing, with or without the “Load form using AJAX”.
Hi @klaggy
Thanks for response!
Maybe we are missing the point here then. Since this topic is already long and we’ve been, sort of, circling in place with this, let’s take a big step back:
Could you please record two short videos/screencast and share with us?
– first one, without any custom code shared here so far, showing the issue (and when sharing accompany it with text description additionally on what we should focus at specifically)
– second one with the most recent code added on site, showing behavior of the site with it
I’m sorry if it causes another delay here but I got a feeling that either we are missing something on our end or there’s some general misunderstanding of both parties – so I’d like to make sure we are all on the same side.
Best regards,
Adam