Your generous donation allows me to continue developing and updating my code!
Here are some simple debouncing examples, utilizing doTimeout. For more usage examples, also see the doTimeout plugin page.
Typing into a textfield (250ms delay)
var default_text = $('#text-type').text(); $('form input').keyup(function(){ $(this).doTimeout( 'text-type', 250, function(){ $('#text-type').text( this.val() || default_text ); }); });
Go ahead, type!
Window resize (some browsers fire this event continually)
$(window).resize(function(){ $.doTimeout( 'resize', 250, function(){ // do something computationally expensive }); });
Window scroll (most browsers fire this event continually)
$(window).scroll(function(){ $.doTimeout( 'scroll', 250, function(){ // do something computationally expensive }); });