2019-03-10 14:30:29 +01:00
|
|
|
---
|
|
|
|
title: <svelte:window> bindings
|
|
|
|
---
|
|
|
|
|
|
|
|
We can also bind to certain properties of `window`, such as `scrollY`. Update line 7:
|
|
|
|
|
2023-04-02 17:24:33 +02:00
|
|
|
```svelte
|
|
|
|
<svelte:window bind:scrollY={y} />
|
2019-03-10 14:30:29 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
The list of properties you can bind to is as follows:
|
|
|
|
|
2023-04-02 17:24:33 +02:00
|
|
|
- `innerWidth`
|
|
|
|
- `innerHeight`
|
|
|
|
- `outerWidth`
|
|
|
|
- `outerHeight`
|
|
|
|
- `scrollX`
|
|
|
|
- `scrollY`
|
|
|
|
- `online` — an alias for `window.navigator.onLine`
|
2019-03-10 14:30:29 +01:00
|
|
|
|
2023-04-02 17:24:33 +02:00
|
|
|
All except `scrollX` and `scrollY` are readonly.
|