From 1109132f09d75da9a28b649c7677bb6ce07c40c0 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:41:45 -0500 Subject: initial commit --- files/es/web/api/window/scroll/index.html | 84 +++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 files/es/web/api/window/scroll/index.html (limited to 'files/es/web/api/window/scroll') diff --git a/files/es/web/api/window/scroll/index.html b/files/es/web/api/window/scroll/index.html new file mode 100644 index 0000000000..ec2c61ab41 --- /dev/null +++ b/files/es/web/api/window/scroll/index.html @@ -0,0 +1,84 @@ +--- +title: Window.scroll() +slug: Web/API/Window/scroll +tags: + - API + - CSSOM View + - Referencia + - metodo +translation_of: Web/API/Window/scroll +--- +
{{APIRef}}
+ +

El método Window.scroll() desplaza la ventana a un lugar particular en el documento.

+ +

Sintaxis

+ +
window.scroll(x-coord, y-coord)
+window.scroll(options)
+
+ +

Parámetros

+ + + +

- o -

+ + + +

Ejemplo

+ +
<!-- poner el pixel 100º verticalmente en el tope superior de la ventana -->
+
+<button onClick="scroll(0, 100);">Clic para desplazarse hacia abajo 100 pixeles</button>
+
+ +

Utilizando options:

+ +
window.scroll({
+  top: 100,
+  left: 100,
+  behavior: 'smooth'
+});
+ +

Notas

+ +

{{domxref("Window.scrollTo()")}} es efectivamente idéntico a este método. Para desplazamiento relativo, mira {{domxref("Window.scrollBy()")}}, {{domxref("Window.scrollByLines()")}} y {{domxref("Window.scrollByPages()")}}.

+ +

Para desplazarse sobre elementos, mira {{domxref("Element.scrollTop")}} y {{domxref("Element.scrollLeft")}}.

+ +

Especificación

+ + + + + + + + + + + + + + + + +
EspecificaciónEstadoComentario
{{ SpecName('CSSOM View', '#dom-window-scroll', 'window.scroll()') }}{{ Spec2('CSSOM View') }}Definición inicial.
+ +

Compatibilidad en navegadores

+ +

{{Compat("api.Window.scroll")}}

+ +

Ver también

+ + -- cgit v1.2.3-54-g00ecf