Skip to content

Commit c25f94d

Browse files
committed
Update 2-ui\1-document\10-size-and-scroll-window\article.md
1 parent f8e38b9 commit c25f94d

File tree

1 file changed

+11
-11
lines changed
  • 2-ui/1-document/10-size-and-scroll-window

1 file changed

+11
-11
lines changed

2-ui/1-document/10-size-and-scroll-window/article.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,33 +76,33 @@ Queste proprietà sono in sola lettura.
7676
## Lo scorrimento con scrollTo, scrollBy, scrollIntoView [#window-scroll]
7777
7878
```warn
79-
To scroll the page with JavaScript, its DOM must be fully built.
79+
Per scorrere la pagina con JavaScript, il DOM deve essere stato completamente elaborato.
8080
81-
For instance, if we try to scroll the page with a script in `<head>`, it won't work.
81+
Se proviamo, ad esempio, a scorrere la pagina con uno script nella sezione `<head>`, non funzionerà.
8282
```
8383
84-
Regular elements can be scrolled by changing `scrollTop/scrollLeft`.
84+
I normali elementi possono essere fatti scorrere modificando `scrollTop/scrollLeft`.
8585
86-
We can do the same for the page using `document.documentElement.scrollTop/scrollLeft` (except Safari, where `document.body.scrollTop/Left` should be used instead).
86+
Possiamo applicare lo stesso principio per la pagina usando `document.documentElement.scrollTop/scrollLeft` (tranne che per Safari, con il quale dovremmo usare invece `document.body.scrollTop/Left`).
8787
88-
Alternatively, there's a simpler, universal solution: special methods [window.scrollBy(x,y)](mdn:api/Window/scrollBy) and [window.scrollTo(pageX,pageY)](mdn:api/Window/scrollTo).
88+
In alternativa, c'è una soluzione più semplice ed universale: i metodi speciali [window.scrollBy(x,y)](mdn:api/Window/scrollBy) e [window.scrollTo(pageX,pageY)](mdn:api/Window/scrollTo).
8989
90-
- The method `scrollBy(x,y)` scrolls the page *relative to its current position*. For instance, `scrollBy(0,10)` scrolls the page `10px` down.
90+
- Il metodo `scrollBy(x,y)` scorre la pagina *in base alla sua posizione corrente*. Per esempio, `scrollBy(0,10)` scorre la pagina di `10px` in basso.
9191
9292
```online
93-
The button below demonstrates this:
93+
Il pulsante in basso dimostra quanto appena affermato:
9494
9595
<button onclick="window.scrollBy(0,10)">window.scrollBy(0,10)</button>
9696
```
97-
- The method `scrollTo(pageX,pageY)` scrolls the page *to absolute coordinates*, so that the top-left corner of the visible part has coordinates `(pageX, pageY)` relative to the document's top-left corner. It's like setting `scrollLeft/scrollTop`.
97+
- Il metodo `scrollTo(pageX,pageY)` scorre la pagina *in base alle coordinate assolute*, di modo che l'angolo superiore sinistro della parte visibile abbia le coordinate `(pageX, pageY)` relative all'angolo superiore sinistro del documento. Di fatto, è come agire sulle proprietà `scrollLeft/scrollTop`.
9898
99-
To scroll to the very beginning, we can use `scrollTo(0,0)`.
99+
Per scorrere fino all'inizio possiamo usare `scrollTo(0,0)`.
100100
101101
```online
102102
<button onclick="window.scrollTo(0,0)">window.scrollTo(0,0)</button>
103103
```
104104
105-
These methods work for all browsers the same way.
105+
Questi metodo godono di un supporto universale da parte di tutti i browser.
106106
107107
## scrollIntoView
108108
@@ -145,7 +145,7 @@ The drawback of the method is that the scrollbar disappears. If it occupied some
145145
146146
That looks a bit odd, but can be worked around if we compare `clientWidth` before and after the freeze. If it increased (the scrollbar disappeared), then add `padding` to `document.body` in place of the scrollbar to keep the content width the same.
147147
148-
## Summary
148+
## Riepilogo
149149
150150
Geometry:
151151

0 commit comments

Comments
 (0)