Skip to content

Instantly share code, notes, and snippets.

@simplesessions
Last active December 25, 2015 20:18
Show Gist options
  • Save simplesessions/7033448 to your computer and use it in GitHub Desktop.
Save simplesessions/7033448 to your computer and use it in GitHub Desktop.
Performant way of checking document size?
windowResizeHandler = null;
$(window).resize(function() {
clearTimeout(windowResizeHandler);
windowResizeHandler = setTimeout(function() {
var docWidth = $('document').width();
if (docWidth > 200) {
// do some'n
}
}, 250);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment