You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 2-ui/1-document/10-size-and-scroll-window/article.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -139,18 +139,18 @@ Prova:
139
139
Il primo pulsante congela lo scorrimento, il secondo invece lo ripristina.
140
140
```
141
141
142
-
We can use the same technique to freeze the scroll for other elements, not just for `document.body`.
142
+
Possiamo usare la stessa tecnica per congelare lo scorrimento anche di altri elementi, non solo di `document.body`.
143
143
144
-
The drawback of the method is that the scrollbar disappears. If it occupied some space, then that space is now free and the content "jumps" to fill it.
144
+
L'inconveniente di questo approccio è che scompare la barra di scorrimento. Se questa occupava uno spazio, allora quello spazio si libererà ed il contenuto si adatterà bruscamente per riempirlo.
145
145
146
-
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.
146
+
Può sembrare un po' strano, ma possiamo aggirare il problema se mettiamo a paragone il valore di `clientWidth` prima e dopo il congelamento. Se aumenta (la barra di scorrimento è scomparsa), allora aggiungiamo `padding` a `document.body` al posto della barra per mantenere la larghezza del contenuto inalterata.
147
147
148
148
## Riepilogo
149
149
150
-
Geometry:
150
+
Proprietà geometriche:
151
151
152
-
- Width/height of the visible part of the document (content area width/height): `document.documentElement.clientWidth/clientHeight`
153
-
- Width/height of the whole document, with the scrolled out part:
152
+
- Larghezza/altezza della parte visibile del documento (larghezza/altezza dell'area del contenuto): `document.documentElement.clientWidth/clientHeight`
153
+
- Larghezza/altezza dell'intero documento, comprese le parti fuori dall'area visibile di scorrimento:
154
154
155
155
```js
156
156
let scrollHeight = Math.max(
@@ -160,7 +160,7 @@ Geometry:
160
160
);
161
161
```
162
162
163
-
Scrolling:
163
+
Scorrimento:
164
164
165
165
- Read the current scroll: `window.pageYOffset/pageXOffset`.
0 commit comments