0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-30 00:46:29 +01:00
svelte/site/content/tutorial/16-special-elements/05-svelte-window-bindings/text.md

21 lines
419 B
Markdown
Raw Normal View History

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:
```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.