Created
November 7, 2013 20:02
-
-
Save dvschultz/7360953 to your computer and use it in GitHub Desktop.
ibooks javascript to determine which device you’re using ibooks on #eprdctn
This file contains hidden or 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
$(document).ready(function() { | |
(function(){ | |
//cache variables | |
var iw = $('html').width(), | |
wh = screen.height; | |
alert('screen height: '+ wh +', inner-width: ' + iw); | |
if (wh == 768 || wh == 1024) { | |
if ( (iw == 567) || (iw == 858) ) $('body').addClass('ibooks-ipad'); | |
} else if (wh == 320 || wh == 480 || wh == 568) { | |
if ( (iw == 270) || (iw == 460) ) $('body').addClass('ibooks-iphone'); | |
} else { | |
$('body').addClass('ibooks-desktop'); | |
} | |
})(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here’s how I then test this in CSS to be sure its working