if(window.orientation!=0){
var obj=document.getElementById('orientation');
alert('横屏内容太少啦,请使用竖屏观看!');
obj.style.display='block';
}
window.onorientatiοnchange=function(){
var obj=document.getElementById('orientation');
if(window.orientation==0){
obj.style.display='none';
}else
{
alert('横屏内容太少啦,请使用竖屏观看!');
obj.style.display='block';
}
};
转载于:https://www.cnblogs.com/Gbeniot/p/4096535.html