Created
March 26, 2015 17:45
-
-
Save Kcko/964fc353e34bdc99d2d5 to your computer and use it in GitHub Desktop.
Resize window with timeout (for responsive testing)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a; | |
$(window).resize(function(){ | |
clearTimeout(a); | |
a = setTimeout(function(){ | |
// call your function | |
},750); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(window).resize( function() { | |
if( timer ) { | |
clearTimeout(timer); | |
} | |
var timer = setTimeout( function() { | |
// On Resize Code Goes Here | |
}, 100 ); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment