I have just started to play around with Twitter Bootstrap API for a project I have coming up. The main nav contains 3 main elements:
Combining the answers from above, this one works for me:
function findBootstrapDeviceSize() {
var dsize = ['lg', 'md', 'sm', 'xs'];
for (var i = dsize.length - 1; i >= 0; i--) {
// Need to add for Chrome. Works fine in Firefox/Safari/Opera without it.
// Chrome seem to have an issue with empty div's
$el = $(' ');
$el.appendTo($('body'));
if ($el.is(':hidden')) {
$el.remove();
return dsize[i];
}
}
return 'unknown';
}