mirror of https://github.com/sveltejs/svelte
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
419 B
21 lines
419 B
6 years ago
|
---
|
||
|
title: <svelte:window> bindings
|
||
|
---
|
||
|
|
||
|
We can also bind to certain properties of `window`, such as `scrollY`. Update line 7:
|
||
|
|
||
|
```html
|
||
|
<svelte:window bind:scrollY={y}/>
|
||
|
```
|
||
|
|
||
|
The list of properties you can bind to is as follows:
|
||
|
|
||
|
* `innerWidth`
|
||
|
* `innerHeight`
|
||
|
* `outerWidth`
|
||
|
* `outerHeight`
|
||
|
* `scrollX`
|
||
|
* `scrollY`
|
||
|
* `online` — an alias for `window.navigator.onLine`
|
||
|
|
||
|
All except `scrollX` and `scrollY` are readonly.
|