• Hello,
    is it possible to scroll down the page without having to click any button?
    In practice, when you open it, the page starts to scroll down automatically.
    It’s possible?
    Thank you

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author malihu

    (@malihu)

    If you can add javascript to your theme/template, you can do it.

    If that’s the case, you could add something like this:

    <script>
        (function($){
            $(window).on("load",function(){
                $.mPageScroll2id("scrollTo","#your-id");
            });
        })(jQuery);
    </script>

    Changing #your-id with the id you want to scroll to.

    You could add the code above in your theme’s/child theme’s footer.php just before the closing body tag (</body>).

    Thread Starter diegothebest

    (@diegothebest)

    is it enough to add this code and that’s it?
    sorry
    Thank you

    Plugin Author malihu

    (@malihu)

    Yes, try it and let me know.

    Thread Starter diegothebest

    (@diegothebest)

    I have to enter the id of this page …
    /wp-admin/post.php?post=6703&action=edit

    but something does not work … where am I wrong?

    thanks for your patience…

    Plugin Author malihu

    (@malihu)

    You need to replace "#your-id" with an id target in your page which represents the position you want to scroll to.

    For example:

    1.Edit your page (e.g. /wp-admin/post.php?post=6703&action=edit).

    2.Place the cursor where you want your page to scroll automatically when it’s loaded. Click the “Insert Page scroll to id target”. Enter page-intro in “id” field and click OK.

    3.Save/update the post/page.

    4.Edit your theme’s footer.php (e.g. in Appearance/Editor) and place the following in a new line right above </body>:

    <script>
        (function($){
            $(window).on("load",function(){
                $.mPageScroll2id("scrollTo","#page-intro");
            });
        })(jQuery);
    </script>

    5.Save/update the file.

    Test you page.

    • This reply was modified 5 years, 11 months ago by malihu.
    Thread Starter diegothebest

    (@diegothebest)

    Perfect, everything works great.
    Thanks so much.
    Last thing please … I need different scrolling speed based on the page to display.
    How can I do?
    Thanks again for the support.

    Plugin Author malihu

    (@malihu)

    Do you need a different scrolling speed/duration for different pages?

    If yes, you need to use WordPress conditional tags. For example, you could do something like this:

    <script>
        (function($){
            $(window).on("load",function(){
                <?php if(is_home()){ ?>
                    $(document).data("mPS2id").scrollSpeed=500; //home scroll speed
                <?php }else if(is_single( '17' )){ ?>
                    $(document).data("mPS2id").scrollSpeed=1300; //post id 17 scroll speed
                <?php } ?>
                $.mPageScroll2id("scrollTo","#page-intro");
            });
        })(jQuery);
    </script>

    Change the scrollSpeed value accordingly.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘automatic scroll’ is closed to new replies.