smooth scrolling html css code example
Example 1: smooth scroll css
html {
scroll-behavior: smooth;
}
http://iamdustan.com/smoothscroll/
Example 2: smooth scroll
// 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'
});
Example 3: scroll smooth css
html {
scroll-behavior: smooth;
}