Quantcast
Channel: portalZINE NMN | Development meets Creativity
Viewing all articles
Browse latest Browse all 68

Delay calls to only fire once the resize event stopped

$
0
0

The timeout is cleared every time a resize event fires, making sure your code is only executed once the resizing actually stopped.

var timer;

$(window).on('resize', function(e) {

  clearTimeout(timer);
  timer = setTimeout(function() {

   // Execute
            
  }, 250);

});

 


Viewing all articles
Browse latest Browse all 68

Trending Articles