File tree 3 files changed +12
-14
lines changed
content/tutorial/03-advanced-svelte/09-special-elements/04-svelte-window
3 files changed +12
-14
lines changed Original file line number Diff line number Diff line change @@ -4,11 +4,11 @@ title: <svelte:window>
4
4
5
5
Just as you can add event listeners to any DOM element, you can add event listeners to the ` window ` object with ` <svelte:window> ` .
6
6
7
- On line 11, add the ` keydown ` listener:
7
+ We've already got a ` handleKeydown ` function declared — now all we need to do is add a ` keydown ` listener:
8
8
9
9
``` svelte
10
10
/// file: App.svelte
11
- <svelte:window on:keydown={handleKeydown}/>
11
+ <svelte:window +++ on:keydown={handleKeydown}+++ />
12
12
```
13
13
14
14
> As with DOM elements, you can add [ event modifiers] ( /tutorial/event-modifiers ) like ` preventDefault ` .
Original file line number Diff line number Diff line change 29
29
}
30
30
31
31
kbd {
32
- background-color : #eee ;
33
32
border-radius : 4px ;
34
33
font-size : 6em ;
35
34
padding : 0.2em 0.5em ;
36
- border-top : 5 px solid rgba ( 255 , 255 , 255 , 0.5 ) ;
37
- border-left : 5px solid
38
- rgba ( 255 , 255 , 255 , 0.5 ) ;
39
- border-right : 5px solid rgba ( 0 , 0 , 0 , 0.2 ) ;
40
- border-bottom : 5px solid rgba ( 0 , 0 , 0 , 0.2 ) ;
35
+ background-color : #eeeeee ;
36
+ border-top : 5px solid #f9f9f9 ;
37
+ border-left : 5 px solid #f9f9f9 ;
38
+ border-right : 5px solid #aaaaaa ;
39
+ border-bottom : 5px solid #aaaaaa ;
41
40
color : #555 ;
42
41
}
43
42
</style >
Original file line number Diff line number Diff line change 29
29
}
30
30
31
31
kbd {
32
- background-color : #eee ;
33
32
border-radius : 4px ;
34
33
font-size : 6em ;
35
34
padding : 0.2em 0.5em ;
36
- border-top : 5 px solid rgba ( 255 , 255 , 255 , 0.5 ) ;
37
- border-left : 5px solid
38
- rgba ( 255 , 255 , 255 , 0.5 ) ;
39
- border-right : 5px solid rgba ( 0 , 0 , 0 , 0.2 ) ;
40
- border-bottom : 5px solid rgba ( 0 , 0 , 0 , 0.2 ) ;
35
+ background-color : #eeeeee ;
36
+ border-top : 5px solid #f9f9f9 ;
37
+ border-left : 5 px solid #f9f9f9 ;
38
+ border-right : 5px solid #aaaaaa ;
39
+ border-bottom : 5px solid #aaaaaa ;
41
40
color : #555 ;
42
41
}
43
42
</style >
You can’t perform that action at this time.
0 commit comments