1jQuery(document).ready(function($) { 2 3 /* De-Bouncer script: pause resize calculations until last resize event is finished */ 4 /* http://www.hnldesign.nl/work/code/debouncing-events-with-jquery/ */ 5 var deBouncer = function($,cf,of, interval){ 6 var debounce = function (func, threshold, execAsap) { 7 var timeout; 8 return function debounced () { 9 var obj = this, args = arguments; 10 function delayed () { 11 if (!execAsap) 12 func.apply(obj, args); 13 timeout = null; 14 } 15 if (timeout) 16 clearTimeout(timeout); 17 else if (execAsap) 18 func.apply(obj, args); 19 timeout = setTimeout(delayed, threshold || interval); 20 }; 21 }; 22 jQuery.fn[cf] = function(fn){ return fn ? this.bind(of, debounce(fn)) : this.trigger(cf); }; 23 }; 24 25 // Register DeBouncing functions 26 // deBouncer(jQuery,'new eventname', 'original event', timeout); 27 // Note: keep the jQuery namespace in mind, don't overwrite existing functions! 28 deBouncer(jQuery,'smartresize', 'resize', 100); 29 deBouncer(jQuery,'smartscroll', 'scroll', 100); 30 31});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.