Nov 21, 2013

javascript - How to detect which device view you're on using Twitter Bootstrap API? - Stack Overflow

javascript - How to detect which device view you're on using Twitter Bootstrap API? - Stack Overflow: "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';
}"

'via Blog this'


Bookmark and Share

No comments:

Post a Comment