a vuejs directive to execute a callback when the binding element is intersecting the viewport
npm install vue-is-intersectingVuejs directive to detect when an element appears into the viewport using the intersection observer api
Via npm:
``bash`
npm install vue-is-intersecting
Via yarn:
`bash`
yarn add vue-is-intersecting
`js
import Vue from "vue";
import IsIntersecting from "vue-is-intersecting";
Vue.use(IsIntersecting);
`
pass the method that you want to use as a callback when the html element appears in the viewport
NB: by default the callback is debounced after 500ms that the element bind appears in the viewport, to execute the callback immediately use the instant modifier.
`html`Hello
unique modifier executes the callback only once
`html`Hello
instant modifier executes the callback immediately, no debounce
`html`Hello
current modifier executes two different callbacks when the element appears or disappears in the viewport
`html``Hello