Skip to content

Instantly share code, notes, and snippets.

@pagemashine
Created November 30, 2017 09:01
Show Gist options
  • Save pagemashine/4821348891af6d57d01e892cb7cf8364 to your computer and use it in GitHub Desktop.
Save pagemashine/4821348891af6d57d01e892cb7cf8364 to your computer and use it in GitHub Desktop.
Works at loading and resizing
$(document).load($(window).bind("resize", listenWidth));
function listenWidth( e ) {
var windowWidth = $(window).width();
if (windowWidth > 767) {
stick();
}
else {
unstick();
}
}
listenWidth(); // Add this here to execute the funtion onload.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment