Reference Address:
http://www.ghugo.com/special-scroll-events-for-jquery/
One of the events in JavaScript is a scrolling event, which triggers an event as long as you drag the scroll bar.
With jquery, this event scroll can view jquery api:http://api.jquery.com/scroll/
However, there is a flaw in the scroll event, which is that only the scroll bar can be judged, not the event when the scrollbar stops scrolling.
Now use jquery to expand the scroll event, adding
Not much to say, directly on the code is really point.
(function(){ varSpecial =jQuery.event.special, Uid1= ' D ' + (+NewDate ()), Uid2= ' D ' + (+NewDate () + 1); Special.scrollstart={setup:function() { varTimer, Handler=function(evt) {var_self = This, _args=arguments; if(timer) {cleartimeout (timer); } Else{Evt.type= ' Scrollstart '; JQuery.event.handle.apply (_self, _args); } Timer= SetTimeout (function() {Timer=NULL; }, Special.scrollstop.latency); }; JQuery ( This). Bind (' scroll ', handler). Data (uid1, handler); }, Teardown:function() {JQuery ( This). Unbind (' scroll ', jQuery ( This). Data (UID1)); } }; Special.scrollstop={latency:300, Setup:function() { varTimer, Handler=function(evt) {var_self = This, _args=arguments; if(timer) {cleartimeout (timer); } Timer= SetTimeout (function() {Timer=NULL; Evt.type= ' Scrollstop '; JQuery.event.handle.apply (_self, _args); }, Special.scrollstop.latency); }; JQuery ( This). Bind (' scroll ', handler). Data (Uid2, handler); }, Teardown:function() {JQuery ( This). Unbind (' scroll ', jQuery ( This). Data (UID2)); } }; })();
You can save the above code to a file, which is equivalent to a plugin, hehe. The calling method is as follows:
(function() { jQuery (window). bind (function() { console.log ("Start") ); }); JQuery (window). bind (function(e) { console.log ("End"); }) ();
Extended jquery Scroll event, support scroll start and scroll stop