Skip to content

Commit 5b9ffea

Browse files
authored
Merge pull request #301 from longo-andrea/review/browser-events
Review Introduction to browser events
2 parents 6edcbb6 + 7e923a2 commit 5b9ffea

7 files changed

Lines changed: 18 additions & 18 deletions

File tree

2-ui/2-events/01-introduction-browser-events/01-hide-other/solution.view/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
<div id="text">Text</div>
1313

1414
<script>
15-
// Here it doesn't matter how we hide the text,
16-
// could also use style.display:
15+
// In questo caso non ha importanza come nascondiamo il testo,
16+
// potremmo anche usare style.display:
1717
document.getElementById('hider').onclick = function() {
1818
document.getElementById('text').hidden = true;
1919
}

2-ui/2-events/01-introduction-browser-events/02-hide-self-onclick/solution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Qui possiamo usare `this` nel gestore per fare riferimento all'"elemento stesso":
1+
Qui potete usare `this` nel gestore per fare riferimento all'"elemento stesso":
22

33
```html run height=50
44
<input type="button" onclick="this.hidden=true" value="Clicca per nascondere">

2-ui/2-events/01-introduction-browser-events/02-hide-self-onclick/task.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ importance: 5
44

55
# Nascondere sé stesso
66

7-
Creare un pulsante che nasconde sé stesso al click.
7+
Create un pulsante che nasconde sé stesso al click.
88

99
```online
1010
Come questo:

2-ui/2-events/01-introduction-browser-events/04-move-ball-field/solution.view/index.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,29 +39,29 @@
3939
<script>
4040
field.onclick = function(event) {
4141

42-
// window-relative field coordinates
42+
// coordinate del campo relative alla finestra
4343
let fieldCoords = this.getBoundingClientRect();
4444

45-
// the ball has position:absolute, the field: position:relative
46-
// so ball coordinates are relative to the field inner left-upper corner
45+
// la palla ha come position:absolute, il campo: position:relative
46+
// quindi le coordinate della palla sono relative all'angolo in alto a sinistra del campo
4747
let ballCoords = {
4848
top: event.clientY - fieldCoords.top - field.clientTop - ball.clientHeight / 2,
4949
left: event.clientX - fieldCoords.left - field.clientLeft - ball.clientWidth / 2
5050
};
5151

52-
// prevent crossing the top field boundary
52+
// preveniamo il superamento del limite superiore del campo
5353
if (ballCoords.top < 0) ballCoords.top = 0;
5454

55-
// prevent crossing the left field boundary
55+
// preveniamo il superamento del limite sinistro del campo
5656
if (ballCoords.left < 0) ballCoords.left = 0;
5757

5858

59-
// // prevent crossing the right field boundary
59+
// preveniamo il superamento del limite destro del campo
6060
if (ballCoords.left + ball.clientWidth > field.clientWidth) {
6161
ballCoords.left = field.clientWidth - ball.clientWidth;
6262
}
6363

64-
// prevent crossing the bottom field boundary
64+
// preveniamo il superamento del limite inferiore del campo
6565
if (ballCoords.top + ball.clientHeight > field.clientHeight) {
6666
ballCoords.top = field.clientHeight - ball.clientHeight;
6767
}

2-ui/2-events/01-introduction-browser-events/06-hide-message/solution.view/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ <h3>Cat</h3>
3030

3131
for(let pane of panes) {
3232
pane.insertAdjacentHTML("afterbegin", '<button class="remove-button">[x]</button>');
33-
// button becomes the first child of pane
33+
// il bottone diventa il primo figlio di pane
3434
pane.firstChild.onclick = () => pane.remove();
3535
}
3636
</script>

2-ui/2-events/01-introduction-browser-events/06-hide-message/task.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ importance: 5
22

33
---
44

5-
# Aggiungere un pulsante di chiusura
5+
# Aggiungete un pulsante di chiusura
66

7-
Abbiamo una lista di messaggi.
7+
Avete una lista di messaggi.
88

99
Aggiungete tramite JavaScript un pulsante di chiusura nell'angolo in alto a destra di ogni messaggio.
1010

2-ui/2-events/01-introduction-browser-events/07-carousel/source.view/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<body>
99

10-
<!-- create your markup and styles -->
10+
<!-- definite il markup e lo stile -->
1111

1212
<button class="arrow"></button>
1313
<button class="arrow"></button>
@@ -28,16 +28,16 @@
2828

2929

3030
<script>
31-
// label the images to visually track them, just for convenience,
32-
// this code can be removed
31+
// etichettiamo le immagini per poterle tracciare visualmente, per comodità,
32+
// questo codice può essere rimosso
3333
let i = 1;
3434
for(let li of carousel.querySelectorAll('li')) {
3535
li.style.position = 'relative';
3636
li.insertAdjacentHTML('beforeend', `<span style="position:absolute;left:0;top:0">${i}</span>`);
3737
i++;
3838
}
3939

40-
// ...your code to make carousel alive!
40+
// ...il vostro codice per rendere vivo il carosello!
4141
</script>
4242

4343
</body>

0 commit comments

Comments
 (0)