Created
April 16, 2014 07:04
JavaScript: Detect Mobile Browser
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
if(jQuery.browser) | |
{ | |
/* SmileyWar.com Mobile Orientation Detection */ | |
// set rules on initial load and when the screen changes size or orientation. | |
$(window).on("load resize",function(){ | |
var h = $(window).height(); | |
var w = $(window).width(); | |
if ( w < 768) { | |
// small mobile screens | |
if(w > h) { | |
// small mobile screens landscape rules | |
}else{ | |
// small mobile screens portrait rules | |
} | |
// all small screen rules | |
}else{ | |
// large mobile screens | |
if(w > h) { | |
// large mobile screen landscape rules | |
}else{ | |
// large mobile screen portrait rules | |
} | |
// all large mobile screen rules | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment