Skip to content

Commit c9febc4

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

File tree

1 file changed

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

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ Nell'HTML moderno dovremmo sempre indicare il `DOCTYPE`.
4040
4141
## Larghezza e altezza del documento
4242
43-
Theoretically, as the root document element is `document.documentElement`, and it encloses all the content, we could measure the document's full size as `document.documentElement.scrollWidth/scrollHeight`.
43+
Teoricamente, poiché l'elemento radice del documento è `document.documentElement` e racchiude tutto il contenuto, potremmo misurare le dimensioni totali del documento con `document.documentElement.scrollWidth/scrollHeight`.
4444
45-
But on that element, for the whole page, these properties do not work as intended. In Chrome/Safari/Opera, if there's no scroll, then `documentElement.scrollHeight` may be even less than `documentElement.clientHeight`! Weird, right?
45+
Ma su questo elemento, per l'intera pagina, queste proprietà non funzionano come dovrebbero. In Chrome/Safari/Opera, nel caso in cui non ci sia barra di scorrimento, `documentElement.scrollHeight` può essere anche minore di `documentElement.clientHeight`! Strano, no?
4646
47-
To reliably obtain the full document height, we should take the maximum of these properties:
47+
Per ottenere l'altezza totale del documento in modo affidabile, dovremmo scegliere il valore maggiore tra queste proprietà:
4848
4949
```js run
5050
let scrollHeight = Math.max(
@@ -53,12 +53,12 @@ let scrollHeight = Math.max(
5353
document.body.clientHeight, document.documentElement.clientHeight
5454
);
5555
56-
alert('Full document height, with scrolled out part: ' + scrollHeight);
56+
alert("Altezza totale del documento, compresa la parte fuori dall'area visibile di scorrimento: " + scrollHeight);
5757
```
5858
59-
Why so? Better don't ask. These inconsistencies come from ancient times, not a "smart" logic.
59+
Perché così? Meglio non chiedere. Queste incongruenze provengono da tempi lontani, non c'è alcuna logica.
6060
61-
## Get the current scroll [#page-scroll]
61+
## Ottenere il valore corrente dello scorrimento [#page-scroll]
6262
6363
DOM elements have their current scroll state in their `scrollLeft/scrollTop` properties.
6464

0 commit comments

Comments
 (0)