webapp强制横屏如何实现?

webapp强制横屏如何实现?

中国扑克大赛 <img src=" (){ var contain = document.getElementById('contain'); var cheight = document.body.clientHeight ; var body = document.getElementsByTagName('body').item(0); var hw = window.innerWidth; var hh = window.innerHeight; if(window.orientation==180||window.orientation==0){ body.style.width = hh + 'px'; body.style.height = cheight+'px'; body.style.webkitTransform = body.style.transform = 'rotateZ(90deg)'; }else } </script> 按照我自己的思路就是把整个body翻转过来,但是后面调整高度和宽度总是调整不好~~~~~有没有其他强制横屏的更好的办法呢?~~~

波斯汪
浏览 1387回答 1
1回答

湖上湖

webapp是在手机浏览器里运行的,应该不能强制横屏,可以尝试借用第三方中间平台(appcan、cordova)打包,调用手机底层方法来实现横竖屏
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

WebApp