Judgment is horizontal screen or vertical screen

function orient () {if (window.orientation == 90 || window.orientation == -90) {// ipad, iphone vertical screen; the Andriod horizontal screen $ ( "body") attr ( "class", "landscape. "); orientation = 'landscape'; return false;} else if (window.orientation == 0 || window.orientation == 180) {// ipad, iphone horizontal screen; the Andriod portrait $ (" body "). attr ( "class", "portrait"); orientation = 'portrait'; return false;}} // call $ (function () {orient ();}); // when the page is loaded when the user calls the screen orientation changes $ (window) .bind ( 'orientationchange', function (e) {orient ();});

Guess you like

Origin www.cnblogs.com/toughy/p/10978183.html