Skip to content

Instantly share code, notes, and snippets.

@KruegerDesigns
Created February 1, 2012 18:17
Show Gist options
  • Select an option

  • Save KruegerDesigns/1718433 to your computer and use it in GitHub Desktop.

Select an option

Save KruegerDesigns/1718433 to your computer and use it in GitHub Desktop.
Add iOS class to html tag for iphone, ipod, and ipad.
// adds ios class to html tag
jQuery(document).ready(function($){
var deviceAgent = navigator.userAgent.toLowerCase();
var agentID = deviceAgent.match(/(iphone|ipod|ipad)/);
if (agentID) {
$('html').addClass('ios');
}
});
@atleastimtrying
Copy link
Copy Markdown

Thanks for this it's very neat and clean!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment