判断手机横竖屏

来源:互联网 发布:ubuntu gcc 安装 编辑:程序博客网 时间:2024/04/28 16:00

//判断手机横竖屏状态:

function hengshuping(){if(window.orientation==180||window.orientation==0){alert("竖屏状态!")}if(window.orientation==90||window.orientation==-90){alert("横屏状态!")}}window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", hengshuping, false);
原创粉丝点击