The behavior property of the ScrollToOptions dictionary specifies whether the scrolling should animate smoothly, or happen instantly in a single jump.

This is actually defined on the ScrollOptions dictionary, which is implemented by ScrollToOptions.


behavior: ScrollBehavior


An enum, the value of which can be one of the following:

  • smooth: The scrolling animates smoothly.
  • auto: The scrolling happens in a single jump.


In our scrolltooptions example (see it live) we include a form that allows the user to enter three values ā€” two numbers representing the left and top properties (i.e. the positions to scroll to along the X and Y axes), and a checkbox indicating whether they want smooth scrolling enabled or not.

When the form is submitted, an event handler is run that puts the entered values into a ScrollToOptions dictionary, and then invokes the Window.ScrollTo() method, passing the dictionary as a parameter:

form.addEventListener('submit', (e) => {
  var scrollOptions = {
    left: leftInput.value,
    top: topInput.value,
    behavior: scrollInput.checked ? 'smooth' : 'auto'



Specification Status Comment
CSS Object Model (CSSOM) View Module
The definition of 'behavior' in that specification.
Working Draft Ā 

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
behaviorChrome Full support 45Edge No support NoFirefox Full support YesIE No support NoOpera Full support 32Safari Full support Yes
Full support Yes
Notes Safari does not have support for the smooth scroll behavior.
WebView Android Full support 45Chrome Android Full support 45Firefox Android Full support YesOpera Android Full support 32Safari iOS No support NoSamsung Internet Android Full support 5.0


Full support Ā 
Full support
No support Ā 
No support
See implementation notes.
See implementation notes.

See also