/html-dom /Basic
GitHub 5008★

Scroll to an element

Scroll to the ele element


Smoothly scroll

The behavior option isn't supported in IE and Safari.

ele.scrollIntoView({ behavior: 'smooth' });

Good to know

The similar CSS property which provides the same functionality is

scroll-behavior: smooth;

It [is not supported](https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-behavior#Browser_compatibility) in IE and Safari.

See also

Follow me on and to get more useful contents.