Skip to content

Instantly share code, notes, and snippets.

@kodie
Last active November 25, 2015 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kodie/c9d152e750716b2a7340 to your computer and use it in GitHub Desktop.
Save kodie/c9d152e750716b2a7340 to your computer and use it in GitHub Desktop.
Get current page breakpoint
function currentBreakpoint() {
var sm = 768;
var md = 992;
var lg = 1200;
var bp;
var win = window.innerWidth;
if (win < sm) { bp = 'xs'; }
if (win >= sm && win < md) { bp = 'sm'; }
if (win >= md && win < lg) { bp = 'md'; }
if (win >= lg) { bp = 'lg'; }
return bp;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment