• Resolved klaggy

    (@klaggy)


    Hey there! ??

    I’m using the pagination option but the Next and Previous buttons don’t navigate to the top of the page which makes for a very awkward user experience, is there any work around that?

    Many thanks!

    • This topic was modified 1 year, 3 months ago by Jan Dembowski. Reason: Added expanded short link into link field

    The page I need help with: [log in to see the link]

Viewing 7 replies - 16 through 22 (of 22 total)
  • Plugin Support Laura – WPMU DEV Support

    (@wpmudevsupport3)

    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…

    Plugin Support Dmytro – WPMU DEV Support

    (@wpmudevsupport16)

    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.

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    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”.

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    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

Viewing 7 replies - 16 through 22 (of 22 total)
  • The topic ‘Previous and Next button don’t go to top of the page’ is closed to new replies.