Window Resize Debounce

Prevents window resize event from triggering code on every pixel. Helpful for performing match heights and other intensive JS functions.

var resizeTimer;

$(window).on('resize', function () {
   clearTimeout(resizeTimer);
   resizeTimer = setTimeout(function() {
      // Code here
   }, 250);
});

Leave a Reply

Your email address will not be published. Required fields are marked *