zoukankan      html  css  js  c++  java
  • [JS代码]如何判断ipad或者iphone是否为横屏或者竖屏

          //判断横屏或者竖屏
            function orient() {
                //alert('gete');
                if (window.orientation == 0 || window.orientation == 180) {
                    document.getElementById("os").innerHTML += "portrait";
                    //$("body").attr("class", "portrait");
                    orientation = 'portrait';
                    return false;
                }
                else if (window.orientation == 90 || window.orientation == -90) {
                    document.getElementById("os").innerHTML += "landscape";
                   // $("body").attr("class", "landscape");
                    orientation = 'landscape';
    
                    return false;
                }
            }

    window.onresize = function (){orient();}

  • 相关阅读:
    vim
    echo
    kill/xkill/killall/pkill/pidof
    ssh
    使用GSON
    使用GSON
    解析JSON
    解析JSON
    Pull解析方式
    Pull解析方式
  • 原文地址:https://www.cnblogs.com/aibo/p/3462624.html
Copyright © 2011-2022 走看看