Last active
August 29, 2015 14:10
-
-
Save barlas/ba534410f46d4cda8ce7 to your computer and use it in GitHub Desktop.
jQuery - Responsive return function triggering on document ready and window resize.
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 windowW = $(window).width(), | |
windowH = $(window).height(); | |
var resizeThread = 0; | |
function responsiveReturn() { | |
clearTimeout(resizeThread); | |
windowW = $(window).width(); | |
windowH = $(window).height(); | |
$('.window-size').css({'width': windowW +'px','height': windowH +'px'}); | |
} | |
responsiveReturn(); | |
$(window).resize(function() { | |
clearTimeout(resizeThread); | |
resizeThread = setTimeout(responsiveReturn,500); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment