1$("my-element").click(function () {
2 $("html, body").animate({
3 scrollTop: 0
4 }, 1000)
5})
1window.scrollTo({top: 0, behavior: 'smooth'});
2
3reference : https://stackoverflow.com/questions/15935318/smooth-scroll-to-top
1$("#button").click(function() {
2 $([document.documentElement, document.body]).animate({
3 scrollTop: $("#elementtoScrollToID").offset().top
4 }, 2000);
5});