Skip to content

Commit ef90b1b

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

File tree

1 file changed

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

1 file changed

+7
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,18 +139,18 @@ Prova:
139139
Il primo pulsante congela lo scorrimento, il secondo invece lo ripristina.
140140
```
141141
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`.
143143
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.
145145
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.
147147
148148
## Riepilogo
149149
150-
Geometry:
150+
Proprietà geometriche:
151151
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:
154154
155155
```js
156156
let scrollHeight = Math.max(
@@ -160,7 +160,7 @@ Geometry:
160160
);
161161
```
162162
163-
Scrolling:
163+
Scorrimento:
164164
165165
- Read the current scroll: `window.pageYOffset/pageXOffset`.
166166
- Change the current scroll:

0 commit comments

Comments
 (0)