css от гладко скролиране
html {
scroll-behavior: smooth;
}
/* No support in IE, or Safari
You can use this JS polyfill for those */
http://iamdustan.com/smoothscroll/
плавно превъртане на jquery onclick
$("#button").click(function() {
$('html, body').animate({
scrollTop: $("#myDiv").offset().top
}, 2000);
});
плавно превъртане
// Scroll to specific values
// scrollTo is the same
window.scroll({
top: 2500,
left: 0,
behavior: 'smooth'
});
// Scroll certain amounts from current position
window.scrollBy({
top: 100, // could be negative value
left: 0,
behavior: 'smooth'
});
// Scroll to a certain element
document.querySelector('.hello').scrollIntoView({
behavior: 'smooth'
});
плавно превъртане на най-високо jquery
window.scrollTo({top: 0, behavior: 'smooth'});
как да се създаде плавен ефект на javasript
how to create a smooth effect in javascript
превъртете до горния jquery
window.scrollTo({top: 0, behavior: 'smooth'});
reference : https://stackoverflow.com/questions/15935318/smooth-scroll-to-top