Skip to content

Instantly share code, notes, and snippets.

@yellowberri-snippets
Created October 28, 2013 21:42
Show Gist options
  • Save yellowberri-snippets/7205364 to your computer and use it in GitHub Desktop.
Save yellowberri-snippets/7205364 to your computer and use it in GitHub Desktop.
JS: Resize Polling Function
var poll = (function(){
var timer = 0;
return function(callback, ms){
clearTimeout(timer);
timer = setTimeout(callback, ms);
};
})();
$(window).resize(function(){
// Poll the window.resize event every 25ms for changes and fire specific code.
poll(function(){
// Call function here.
}, 25);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment