1. Utilities
  2. windowScroll

Utilities

windowScroll

Scrolling position of window.

Usage

Demo

ScrollX: undefined
ScrollY: undefined
        <script>
  import { onMount } from "svelte";
  import { windowScroll } from "sveltronics";

  let { x, y } = {};
  
  onMount(() => {
    ({ x, y } = windowScroll());
  })
</script>

<div>
  <div>ScrollX: {$x}</div>
  <div>ScrollY: {$y}</div>
</div>