Skip to content

Commit e1bae9b

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

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
@@ -4,24 +4,24 @@ Come scoprire la larghezza e l'altezza della finestra del browser? Come ricavare
44

55
Per questo genere di informazioni possiamo utilizzare l'elemento radice del documento `document.documentElement`, che corrisponde al tag `<html>`. Ci sono, tuttavia, ulteriori metodi e peculiarità da considerare.
66

7-
## Width/height of the window
7+
## Larghezza e altezza della finestra
88

9-
To get window width and height, we can use the `clientWidth/clientHeight` of `document.documentElement`:
9+
Per ottenere la larghezza e l'altezza della finestra, possiamo far uso delle proprietà `clientWidth/clientHeight` di `document.documentElement`:
1010

1111
![](document-client-width-height.svg)
1212

1313
```online
14-
For instance, this button shows the height of your window:
14+
Ad esempio questo pulsante mostra l'altezza della tua finestra:
1515
1616
<button onclick="alert(document.documentElement.clientHeight)">alert(document.documentElement.clientHeight)</button>
1717
```
1818

19-
````warn header="Not `window.innerWidth/innerHeight`"
20-
Browsers also support properties like `window.innerWidth/innerHeight`. They look like what we want, so why not to use them instead?
19+
````warn header="Non usare `window.innerWidth/innerHeight`"
20+
I browser supportano inoltre proprietà come `window.innerWidth/innerHeight`. Sembra che facciano al nostro caso, quindi perché non usare queste?
2121

22-
If there exists a scrollbar, and it occupies some space, `clientWidth/clientHeight` provide the width/height without it (subtract it). In other words, they return the width/height of the visible part of the document, available for the content.
22+
Se esiste una barra di scorrimento ed occupa uno spazio, `clientWidth/clientHeight` forniscono la larghezza e l'altezza al netto della barra (la sottraggono). In altre parole restituiscono le dimensioni della parte visibile del documento disponibile per il contenuto.
2323

24-
`window.innerWidth/innerHeight` includes the scrollbar.
24+
`window.innerWidth/innerHeight` includono la barra di scorrimento.
2525

2626
If there's a scrollbar, and it occupies some space, then these two lines show different values:
2727
```js run

0 commit comments

Comments
 (0)