Skip to content

Instantly share code, notes, and snippets.

@codescribblr
Created January 8, 2016 14:24
Show Gist options
  • Select an option

  • Save codescribblr/826a5734b1b3d935f48a to your computer and use it in GitHub Desktop.

Select an option

Save codescribblr/826a5734b1b3d935f48a to your computer and use it in GitHub Desktop.
best cross-browser way to get "actual" window width in js. This replaces the previously used $(window).width() that was unreliable because of the scroll bar. Requires Modernizr.
if (Modernizr.mq('(max-width: 767px)')) {
//...
} else {
//...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment