aboutsummaryrefslogtreecommitdiff
path: root/files/pt-br/web/api/window/scrolly
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:52 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:52 -0500
commit074785cea106179cb3305637055ab0a009ca74f2 (patch)
treee6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/pt-br/web/api/window/scrolly
parentda78a9e329e272dedb2400b79a3bdeebff387d47 (diff)
downloadtranslated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz
translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2
translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip
initial commit
Diffstat (limited to 'files/pt-br/web/api/window/scrolly')
-rw-r--r--files/pt-br/web/api/window/scrolly/index.html76
1 files changed, 76 insertions, 0 deletions
diff --git a/files/pt-br/web/api/window/scrolly/index.html b/files/pt-br/web/api/window/scrolly/index.html
new file mode 100644
index 0000000000..28d7fd8797
--- /dev/null
+++ b/files/pt-br/web/api/window/scrolly/index.html
@@ -0,0 +1,76 @@
+---
+title: Window.scrollY
+slug: Web/API/Window/scrollY
+translation_of: Web/API/Window/scrollY
+---
+<div>{{APIRef}}</div>
+
+<h2 id="Summary" name="Summary">Sumário</h2>
+
+<p>Retorna o número de pixels que o documento já rolou verticalmente.</p>
+
+<h2 id="Syntax" name="Syntax">Sintaxe</h2>
+
+<pre class="syntaxbox">var y = window.scrollY;
+</pre>
+
+<ul>
+ <li>y é o número atual de pixels que o documento rolou a partir do topo.</li>
+</ul>
+
+<h2 id="Example" name="Example">Exemplo</h2>
+
+<pre class="brush:js">// verificar e ir para a segunda página
+if (window.scrollY) {
+ window.scroll(0, 0); // reinicia a posição do scroll para a posição superior esquerda do documento.
+}
+
+window.scrollByPages(1);</pre>
+
+<h2 id="Notes" name="Notes">Notas</h2>
+
+<p>Utilize esta propriedade para verificar se o documento já foi rolado quando funções de rolagem relativa, tais como {{domxref("window.scrollBy")}}, {{domxref("window.scrollByLines")}}, ou {{domxref("window.scrollByPages")}}, forem utilizadas.</p>
+
+<p>A propriedade <code>pageYOffset é um alias para scrollY:</code></p>
+
+<pre>window.pageYOffset == window.scrollY; // always true</pre>
+
+<p>For cross-browser compatibility, use <code>window.pageYOffset</code> instead of <code>window.scrollY</code>. <strong>Additionally</strong>, older versions of Internet Explorer (&lt; 9) do not support either property and must be worked around by checking other non-standard properties. A fully compatible example:</p>
+
+<p>Para compatibilidade cross-browser, utilize window.pageYOffset em vez de window.scrollY. Além disso, versões inferiores do Internet Explorer 9 não suportam ambas as propriedades, e deve ser contornado verificando outras propriedades não padronizadas.</p>
+
+<pre class="brush:js">var supportPageOffset = window.pageXOffset !== undefined;
+var isCSS1Compat = ((document.compatMode || "") === "CSS1Compat");
+
+var x = supportPageOffset ? window.pageXOffset : isCSS1Compat ? document.documentElement.scrollLeft : document.body.scrollLeft;
+var y = supportPageOffset ? window.pageYOffset : isCSS1Compat ? document.documentElement.scrollTop : document.body.scrollTop;
+</pre>
+
+<h2 id="Specification" name="Specification">Especificação</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{ SpecName('CSSOM View', '#dom-window-scrolly', 'window.scrollY') }}</td>
+ <td>{{ Spec2('CSSOM View') }}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<p>{{Compat("api.Window.scrollY")}}</p>
+
+<h2 id="See_also" name="See_also">Veja também</h2>
+
+<ul>
+ <li>{{domxref("window.scrollX")}}</li>
+</ul>