diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
commit | 074785cea106179cb3305637055ab0a009ca74f2 (patch) | |
tree | e6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/pt-br/web/api/element/scrollintoview | |
parent | da78a9e329e272dedb2400b79a3bdeebff387d47 (diff) | |
download | translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2 translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip |
initial commit
Diffstat (limited to 'files/pt-br/web/api/element/scrollintoview')
-rw-r--r-- | files/pt-br/web/api/element/scrollintoview/index.html | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/files/pt-br/web/api/element/scrollintoview/index.html b/files/pt-br/web/api/element/scrollintoview/index.html new file mode 100644 index 0000000000..28714a4b1e --- /dev/null +++ b/files/pt-br/web/api/element/scrollintoview/index.html @@ -0,0 +1,89 @@ +--- +title: Element.scrollIntoView() +slug: Web/API/Element/scrollIntoView +tags: + - API + - CSSOM Views + - DOM + - Elemento + - Experimental + - Referencia + - Rolagem + - View + - metodo + - scrollIntoView +translation_of: Web/API/Element/scrollIntoView +--- +<div>{{ APIRef("DOM")}}{{SeeCompatTable}}</div> + +<p>O método <code><strong>Element.scrollIntoView()</strong></code> move o elemento ao qual é aplicado para a área visível da janela do navegador.</p> + +<h2 id="Sintaxe">Sintaxe</h2> + +<pre class="syntaxbox notranslate">element.scrollIntoView(); // Equivalente a element.scrollIntoView(true) +element.scrollIntoView(<var>alignToTop</var>); // Argumentos booleanos +element.scrollIntoView(<var>scrollIntoViewOptions</var>); // argumento Objeto +</pre> + +<h3 id="Parâmetros">Parâmetros</h3> + +<dl> + <dt><code>alignToTop</code> {{optional_inline}}</dt> + <dd>É um valor {{jsxref("Boolean")}}: + <ul> + <li>Se <code>true</code>, a parte superior do elemento ficará alinhada com o topo da área visível do elemento-pai. Correponde a <code>scrollIntoViewOptions: {block: "start", inline: "nearest"}</code>. Este é o valor default.</li> + <li><code><font face="Open Sans, Arial, sans-serif">Se </font>false</code>, a parte inferior do elemento ficará alinhada com o fundo da área visível do elemento-pai. Corresponde a <code>scrollIntoViewOptions: {block: "end", inline: "nearest"}</code></li> + </ul> + </dd> + <dt><code>scrollIntoViewOptions</code> {{optional_inline}}</dt> + <dd>Um booleano ou um objeto com as seguintes opções:</dd> + <dd> + <pre class="idl notranslate">{ + behavior: <strong>"auto"</strong> | "instant" | "smooth", + block: <strong>"start"</strong> | "center" | "end" | "nearest", + inline: "start" | "center" | "end" | "<strong>nearest</strong>" +}</pre> + </dd> + <dd>Caso seja um valor booleano, true corresponde a <code>{block: "start"}</code> e false<font face="Consolas, Liberation Mono, Courier, monospace"> a</font> <code>{block: "end"}</code>.</dd> +</dl> + +<h2 id="Exemplo">Exemplo</h2> + +<pre class="brush: js notranslate">var element = document.getElementById("box"); + +element.scrollIntoView(); +element.scrollIntoView(false); +element.scrollIntoView({block: "end"}); +element.scrollIntoView({block: "end", behavior: "smooth"}); +</pre> + +<h2 id="Observações">Observações</h2> + +<p>O elemento poderá não ser movido completamento ao topo ou ao fundo dependendo de sua composição com outros elementos.</p> + +<h2 id="Especificações">Especificações</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th>Especificação</th> + <th>Status</th> + <th>Comentário</th> + </tr> + <tr> + <td>{{SpecName("CSSOM View", "#dom-element-scrollintoview", "Element.scrollIntoView()")}}</td> + <td>{{Spec2("CSSOM View")}}</td> + <td>Definição inicial</td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilidade_com_navegadores">Compatibilidade com navegadores</h2> + +<p>{{Compat("api.Element.scrollIntoView")}}</p> + +<h2 id="Veja_também">Veja também</h2> + +<ul> + <li>{{domxref("Element.scrollIntoViewIfNeeded()")}}<a href="/en-US/docs/Web/API/Element/scrollIntoViewIfNeeded"> </a>{{non-standard_inline}}</li> +</ul> |