Kcko
3/26/2015 - 5:45 PM

Resize window with timeout (for responsive testing)

Resize window with timeout (for responsive testing)

 
$(window).resize( function() {
if( timer ) {
clearTimeout(timer);
}
 
var timer = setTimeout( function() {
// On Resize Code Goes Here
}, 100 );
}); 
$(window).bind('resize', function(e){
    window.resizeEvt;
    $(window).resize(function(){
        clearTimeout(window.resizeEvt);
        window.resizeEvt = setTimeout(function(){
        //code to do after window is resized
        }, 250);
    });
});
var a;
$(window).resize(function(){
  clearTimeout(a);
  a = setTimeout(function(){
    // call your function
  },750);
});