Пролистать наверх
const goToTop = () => window.scrollTo(0, 0);
goToTop();
thefazeelahmed
const goToTop = () => window.scrollTo(0, 0);
goToTop();
onActivate(event) {
// window.scroll(0,0);
window.scroll({
top: 0,
left: 0,
behavior: 'smooth'
});
//or document.body.scrollTop = 0;
//or document.querySelector('body').scrollTo(0,0)
...
}
$("#scroll_icon").click(function()
{
jQuery('html,body').animate({scrollTop:0},2000);
})
const scrollToTop = (element) =>
element.scrollIntoView({ behavior: "smooth", block: "start" });
$(document).ready(function(){
$(".scroll-top").click(function() {
$("html, body").animate({
scrollTop: 0
}, "slow");
return false;
});
});