Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save addisonbgross/522f1d0c8b3f630f8ce63ff78597ad99 to your computer and use it in GitHub Desktop.
Save addisonbgross/522f1d0c8b3f630f8ce63ff78597ad99 to your computer and use it in GitHub Desktop.
Window resize event listener with an added delay. This stops the resize event from firing constantly while resizing
function handleResize() {
clearTimeout(this.delayer);
this.delayer = setTimeout(someNamedFunction, 200);
}
window.addEventListener('resize', handleResize);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment