Skip to content

Releases: metonym/svelte-intersection-observer

v0.6.1

03 Apr 12:27
Compare
Choose a tag to compare

Fixes

  • move intersection observer instantiation to onMount to work in hydration use cases (#13, contributed by @nosovk)

v0.6.0

24 Feb 13:16
Compare
Choose a tag to compare

Features

  • export observer prop (type IntersectionObserver)
  • dispatch "intersect" event if the observed element isIntersecting the viewport

v0.5.0

20 Jan 23:21
Compare
Choose a tag to compare

Features

  • Add support for Server-Side Rendering (SSR)

v0.4.0

20 Dec 19:35
Compare
Choose a tag to compare

Features

  • Export intersecting prop

Fixes

  • Remove observer from module context to allow multiple component instantiations (#7)
  • Fix prop type for entry

Documentation

  • Bind the intersecting prop in the demo / Svelte REPL, which is more concise than binding to entry

    <script>
      import IntersectionObserver from "svelte-intersection-observer";
    
      let element;
      let intersecting;
    </script>
    
    <header>
      <strong>Scroll down.</strong>
      <div>
        Element in view?
        <strong class:intersecting>{intersecting ? 'Yes' : 'No'}</strong>
      </div>
    </header>
    
    <IntersectionObserver {element} bind:intersecting>
      <div bind:this={element}>
        {#if intersecting}Element is in view{/if}
      </div>
    </IntersectionObserver>

v0.3.0

23 Nov 19:17
Compare
Choose a tag to compare

Features

  • Export entry (IntersectionObserverEntry) as a reactive prop

This allows for more concise code:

<IntersectionObserver {element} bind:entry>
  <div class="element" bind:this="{element}">
    {#if entry && entry.isIntersecting}
      Element is in view
    {/if}
  </div>
</IntersectionObserver>

v0.2.0

19 Nov 02:04
Compare
Choose a tag to compare
  • add TypeScript definitions