Javascript Algorithm To Determine Orientation Of Tablet
We're building an HTML5/JavaScript app developed for tablets, and we want to lay out my screens differently in landscape versus portrait.   Originally, we were capturing orientatio
Solution 1:
Try this:
<span id="orientation">orientation</span>
$(document).ready(checkOrientation);
$(window).resize(checkOrientation);
functioncheckOrientation() {
    var orientation = "Portrait";
    var screenWidth = $(window).width();
    var screenHeight = $(window).height();
    if (screenWidth > screenHeight) {
        orientation = "Landscape";
    }
    $("#orientation").html(orientation);
}
Post a Comment for "Javascript Algorithm To Determine Orientation Of Tablet"