jquery scroll top of page code example
Example 1: jquery scroll to top of div
$('#DIV_ID').scrollTop(0);
Example 2: scroll to top jquery
window.scrollTo({top: 0, behavior: 'smooth'});
reference : https://stackoverflow.com/questions/15935318/smooth-scroll-to-top
Example 3: scrool to top jquerry
$("a[href='#top']").click(function() {
$("html, body").animate({ scrollTop: 0 }, "slow");
return false;
});
Example 4: jquery get document scrolltop
var top = ($(window).scrollTop() || $("body").scrollTop());