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/scrollby/index.html | 85 +++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 files/es/web/api/window/scrollby/index.html (limited to 'files/es/web/api/window/scrollby') diff --git a/files/es/web/api/window/scrollby/index.html b/files/es/web/api/window/scrollby/index.html new file mode 100644 index 0000000000..e07da04b65 --- /dev/null +++ b/files/es/web/api/window/scrollby/index.html @@ -0,0 +1,85 @@ +--- +title: Window.scrollBy() +slug: Web/API/Window/scrollBy +tags: + - API + - CSSOM View + - Método(2) + - NeedsCompatTable + - NeedsSpecTable + - Referencia +translation_of: Web/API/Window/scrollBy +--- +

{{ APIRef() }}

+ +

Resumen

+ +

Desplaza el documento el número de pixels proporcionados.

+ +

Sintaxis

+ +
window.scrollBy(X, Y);
+window.scrollBy(opciones)
+ +

Parámetros

+ + + +

Si X o Y son positivos, desplazarán la página hacia la derecha o hacia abajo respectivamente. Si son negativos, la desplazarán hacia la izquierda o hacia arriba respectivamente.

+ +

- or -

+ + + +

Ejemplo

+ +
// Desplazarse la longitud de una página
+window.scrollBy(0, window.innerHeight);
+
+ +

Para hacer scroll hacia arriba:

+ +
window.scrollBy(0, -window.innerHeight);
+ +

Utilizando opciones:

+ +
window.scrollBy({
+  top: 100,
+  left: 100,
+  behaviour: 'smooth'
+})
+ +

Notas

+ +

window.scrollBy desplaza el documento una cantidad determinada, mientras que window.scroll lo hace hacia una posición absoluta en el documento. Vea también window.scrollByLines, window.scrollByPages

+ +

Especificación

+ + + + + + + + + + + + + + + + +
EspecificaciónEstadoComentarios
{{ SpecName('CSSOM View', '#dom-window-scrollby', 'window.scrollBy()') }}{{ Spec2('CSSOM View') }}Definición inicial.
-- cgit v1.2.3-54-g00ecf