在ios中横屏之后再竖回来样式就都变形了,我加个alert就可以了,不加alert怎么才能可行呢?或者直接禁止横屏
正常页面:
横屏了一下 在竖回来
我在代码中写了alert就可以变回来
写了console.log()就不行
window.onorientationchange=function(){
if(window.orientation==90||window.orientation==-90){
alert('为了您更好的体验,请保持竖屏');
}else{
alert('没有横屏');
}
}
问题1:为什么写了alert就可以呢?写了console不行呢?
问题2:有没有可能把横屏直接禁止掉不让横屏呢?
可能是
dom
的问题,试下滚动1px