xxxxxxxxxx
$(document).ready(function(){
$("#totop").show(),$(window).scroll(function(){$(window).scrollTop()>=500&&$(window).scrollTop()<=$(document).height()-600?$("#totop").show():$("#totop").hide()})}),
$("#totop").on("click",function(o){return o.preventDefault(),$("html, body").animate({scrollTop:0},"slow"),!1});
xxxxxxxxxx
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)
}
xxxxxxxxxx
// Add an event listener to the button with id "goto-top"
$('#main-chat-content').on('click', '#goto-top', function () {
// Scroll to the top of the page
window.scrollTo(0, 0);
});
xxxxxxxxxx
$("#scroll_icon").click(function()
{
jQuery('html,body').animate({scrollTop:0},2000);
})
xxxxxxxxxx
const scrollToTop = (element) =>
element.scrollIntoView({ behavior: "smooth", block: "start" });
xxxxxxxxxx
$(document).ready(function(){
$(".scroll-top").click(function() {
$("html, body").animate({
scrollTop: 0
}, "slow");
return false;
});
});