Javascript Media Query Hack
I’ve seen this somewhere before…
HTML
<span id="smScreenIndicator"></span>
CSS
#smScreenIndicator { float: left; }
@media (min-width: 400px) { /* whatever width suits the project */
#smScreenIndicator { float: none; }
}
JQuery
function isMobile() {
if ( $('#smScreenIndicator').css('float') == 'left' ) return true;
else return false;
}
Category —
Leave a Reply