Detecting the client device easily with device.js
Device.js will update automatically the classes in the HTML tag based on the device and orientation. Example:
<html lang="en" class=" desktop portrait">
When I change my user agent to iPad iOS 6, it shows:
<html lang="en" class="ios ipad tablet portrait">
Then you can use those classes to style your website accordingly.
device.portrait() === true device.landscape() === false device.mobile() === false device.tablet() === false device.ipad() === false device.ipod() === false device.iphone() === false device.android() === false device.androidTablet() === false device.blackberryTablet() === false