Created
September 4, 2015 14:29
-
-
Save jonnymaceachern/9e2cea7e117f8142a00d to your computer and use it in GitHub Desktop.
A resize event is triggered when a mobile browsers address bar drops down (when changing directions in a scroll). This will let you check for only width resizes. From http://stackoverflow.com/questions/10750603/jquery-detect-a-window-width-change-but-not-a-height-change
This file contains hidden or 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 width = $(window).width(); | |
$(window).resize(function(){ | |
if($(this).width() != width){ | |
width = $(this).width(); | |
console.log(width); | |
// your code | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
great, thanks!