//为ipad横屏添加样式
function hengshuping(){
if(window.orientation===180||window.orientation===0){//竖屏
document.getElementsByTagName('body')[0].classList.remove('ipadheng');
}
if(window.orientation===90||window.orientation===-90){//横屏
document.getElementsByTagName('body')[0].classList.add('ipadheng');
}
}
window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", hengshuping, false);
判断ipad横竖屏
最新推荐文章于 2021-11-02 15:11:01 发布