endedEvents
adds events for when expensive evnts (like scroll and resize) have ended. Demo @ http://beechbot.com/demos/endedEvents/
Requirements
- ie9 or later (support required for addEventListener)
- OPTIONAL - jQuery
Usage
- add the js
- init like :
endedEvents.init();
- or - fancy like setting the throttle*
endedEvents.init(50);
- or - real fancy like
endedEvents.init(50, $jquery);
(to pass a specific version of jQuery) - we are defined as 'endedEvents' for AMD
* throttle
- how often the timers are run in milliseconds.
- lower numbers are run more frequently, but this is obviously more expensive.
- defaults to
150
with JQuery
- if you have jquery in scope, or you pass it to the init ....
- you'll get some new events :
'scrollStopped', 'resizeStopped'
- so you can use them like :
$("#thing").on('scrollStopped', function(){
// your function here ...
});
demo : (scroll or resize your browser to test)
or check your console ...
stoppedScroll :
stoppedResize :