Auto Page Scroll by clicking a link?

Hi,
Is there some way to have a page Auto Scroll down to a certain point in the page when clicking a link? (on a standard Product WooCommerce Page) in a similar way that some one page parallax themes scroll down?

Thanks
Tom

  • Ash

    Hello @Tom

    Welcome to WPMU community!

    I hope you are well today and thanks for asking the question.

    Add an ID to the scrolling target point, like:

    <div ld="scroll_target">
    Add the content here where the page will reach after scrolling
    </div>

    In the link add like the following:

    <a href="#scroll_target" id="scrollTo">Link</a>

    And then add the following code in your theme's footer.php:

    <script type="text/javascript">
    $("#scrollTo").click(function() {
        $('html, body').animate({
            scrollTop: $("#scroll_target").offset().top
        }, 2000);
    });
    </script>

    This highly recommended to use a child theme in this case, as the changes will be lost when you will update the theme. You can learn more about child theme here: http://codex.wordpress.org/Child_Themes

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.

    Cheers
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.