UNPKG

scroll-triggle-fn

Version:

a simple scroll triggle that allows you run function when you scroll to specific dom element

28 lines (21 loc) 502 B
#### Installation ``` npm i scroll-triggle-fn --save npm i jquery --save ``` #### Usage ``` var scrollTriggleFn = require("scroll-triggle-fn") import $ from 'jquery'; $('ducument').ready(function(){ const callback = function(e) { $(e).css('color','#fff'); } const config = { delay: 0, // default: 0 position: 'top' //'button', 'mid' default: 'top' } const selector = 'h1'; scrollTriggleFn(selector, e, config); }); ```