Detects your element in viewport and allows you to add a callback function.
Use npm to install js-element-spy.
npm install js-element-spy --save
import { elementSpy } from 'js-element-spy';
elementSpy(
'.my-element',
() => {
// Set your logic here
},
'scroll'
);
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.