Nuestros voluntarios aún no han traducido este artículo al Español. ¡Únete a nosotros y ayúdanos a traducirlo!
También puedes leer el artículo en English (US).

The scrollTo() method of the Element interface scrolls to a particular set of coordinates inside a given element.

Syntax

element.scrollTo(x-coord, y-coord)
element.scrollTo(options)

Parameters

  • x-coord is the pixel along the horizontal axis of the element that you want displayed in the upper left.
  • y-coord is the pixel along the vertical axis of the element that you want displayed in the upper left.

- or -

Examples

element.scrollTo(0, 1000);

Using options:

element.scrollTo({
  top: 100,
  left: 100,
  behavior: 'smooth'
});

Specifications

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

Browser Compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
scrollToChrome Full support 45Edge No support NoFirefox Full support YesIE No support NoOpera Full support 32Safari Full support 10WebView Android Full support 45Chrome Android Full support 45Edge Mobile No support NoFirefox Android Full support YesOpera Android Full support 32Safari iOS No support NoSamsung Internet Android Full support Yes
ScrollToOptions parameterChrome Full support 45Edge No support NoFirefox Full support YesIE No support NoOpera Full support 32Safari No support NoWebView Android Full support 45Chrome Android Full support 45Edge Mobile No support NoFirefox Android Full support YesOpera Android Full support 32Safari iOS No support NoSamsung Internet Android Full support Yes

Legend

Full support  
Full support
No support  
No support

See also

Etiquetas y colaboradores del documento

Colaboradores en esta página: myf, mdnwebdocs-bot, mfluehr, chrisdavidmills
Última actualización por: myf,