Last active
April 10, 2017 09:49
-
-
Save diego-betto/f6bbb7ba4b78f6d516b75c7329bc51b7 to your computer and use it in GitHub Desktop.
JS: find current bootstrap 3 breakpoint
This file contains 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
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