svelte-intersection-api-action

Svelte Intersection Api Action

A Svelte action to easily integrate the Intersection Observer API

Svelte Intersection Observer Action

Easily integrate the Intersection Observer API in Svelte

See the demo

Installation

npm install svelte-intersection-api-action

Usage

<script>
  import { intersectionAPI } from "svelte-intersection-api-action";

</script>

<div use:intersectionAPI={{ options }} on:crossed={(e)=>doSomething(e.detail)}>
</div>

Props

options : The options used by the Intersection Observer API

e.detail : An IntersectionObserverEntry, is dispatched when a threshold is crossed

License

Distributed under the MIT License.

Top categories

Loading Svelte Themes