jQuery on click scroll to content

,

I needed a way to on clicking of an A tag scroll to top of a list that was getting updated.  So here is the code that I came across.

<script>
jQuery(document).ready(function() {
    jQuery('a.link-designation').on("click", function () {
        jQuery('html, body').animate({
            scrollTop: (jQuery('#top-of-list').offset().top)
        },500);
    });
});
</script>

 

Skills

Posted on

September 1, 2020

Submit a Comment

Your email address will not be published. Required fields are marked *