forked from dbabaioff/scroll.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscroll.min.js
1 lines (1 loc) · 830 Bytes
/
scroll.min.js
1
var Scroll=function(){var a,b={},c=function(a,b,c){a.attachEvent?(a["e"+b+c]=c,a[b+c]=function(){a["e"+b+c](window.event)},a.attachEvent("on"+b,a[b+c])):a.addEventListener(b,c,!1)},d=function(){var a=!1;c(window,"scroll",function(){a=!0}),setInterval(function(){if(a){a=!1;var c;for(c in b)b[c].on&&b[c].fn()}},250)};return d(),a=function(){},a.prototype={bind:function(a,c){var d;if(typeof a=="object")for(d in a)b[d]={fn:a[d],on:!0};else if(typeof a=="string"){a=a.split(" ");for(var e=0,f=a.length;e<f;e++)b[a[e]]={fn:c,on:!0}}return this},unbind:function(a){var c;if(typeof a=="undefined")for(c in b)delete b[c];else if(typeof a=="string"){a=a.split(" ");for(var d=0,e=a.length;d<e;d++)delete b[a[d]]}return this},on:function(a,c){return b[a].on=typeof c!="undefined"?c:!0,this},off:function(a){return this.on(a,!1)}},new a}()