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
/*Adding a CSS class to the html element (Modernizr-style)*/ | |
document.documentElement.className += ' ' + (WURFL.is_mobile ? '' : 'no-') + "mobile"; /*adds class="mobile" or class="no-mobile" to html element*/ | |
document.documentElement.className += ' ' + WURFL.form_factor.toLowerCase(); /*Adding the formfactor as class name to html element*/ | |
document.documentElement.className += ' ' + WURFL.complete_device_name.toLowerCase().replace(/\s+/g, ''); /*Removing spaces, and puts the complete device name as the class name on html element*/ | |
/*...or using data- attributes. In the CSS we can then do stuff like:*/ | |
document.documentElement.setAttribute('data-device_name', WURFL.complete_device_name); | |
document.documentElement.setAttribute('data-form_factor', WURFL.form_factor ); | |
document.documentElement.setAttribute('data-is_mobile', WURFL.is_mobile ); |
NewerOlder