how to scroll page to top in jquery code example
Example 1: jquery scroll to top of div
$('#DIV_ID').scrollTop(0);
Example 2: scrool to top jquerry
$("a[href='#top']").click(function() {
$("html, body").animate({ scrollTop: 0 }, "slow");
return false;
});
Example 3: javascript go to top of page
//EITHER:
window.scroll({
top: 0,
left: 0,
behavior: 'smooth'
});
//*****************************
//OR:
window.scroll({top: 0, left: 0});
//Or with jQuery
$('html,body').scrollTop(0);
//with animation
$('html, body').animate({ scrollTop: 0 }, 'fast');