Skip to content

Instantly share code, notes, and snippets.

@diego-betto
Last active April 10, 2017 09:49
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 diego-betto/f6bbb7ba4b78f6d516b75c7329bc51b7 to your computer and use it in GitHub Desktop.
Save diego-betto/f6bbb7ba4b78f6d516b75c7329bc51b7 to your computer and use it in GitHub Desktop.
JS: find current bootstrap 3 breakpoint
window.findBootstrapEnvironment = function() {
var envs = ['xs', 'sm', 'md', 'lg'];
var $el = jQuery('<div>');
$el.appendTo(jQuery('body'));
for (var i = envs.length - 1; i >= 0; i--) {
var env = envs[i];
$el.addClass('hidden-'+env);
if ($el.is(':hidden')) {
$el.remove();
return env;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment