Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function debouncer( func , timeout ) {
- var timeoutID , timeout = timeout || 200;
- return function () {
- var scope = this , args = arguments;
- clearTimeout( timeoutID );
- timeoutID = setTimeout( function () {
- func.apply( scope , Array.prototype.slice.call( args ) );
- } , timeout );
- }
- }
- $( window ).resize( debouncer( function ( e ) {
- // do stuff
- } ) );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement