l***@163.com
l***@163.com
  • 发布:2016-05-08 10:54
  • 更新:2016-05-08 10:54
  • 阅读:1912

Hbuilder 有没有横竖屏检测的demo?

分类:HTML5+

Hbuilder 有没有横竖屏检测的demo?现在有个需求需要用到横竖屏,之前用的是
//window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", function() {
//// if (window.orientation === 180 || window.orientation === 0) {
//// //plus.webview.currentWebview().close();
//// var param={groupId:groupId};
//// openWindows('onair.html','onair',param,'yes');
//// }
// if (window.orientation === 90 || window.orientation === -90 ){
// //plus.webview.currentWebview().close();
//// var param={groupId:groupId};
//// openWindows('hengping.html','hengping',param,'yes');
// window.location.href='http://ask.dcloud.net.cn/hengping.html';
// }
//}, false);
这个方法来检测横竖屏,但是一直 有崩溃(不是每次都会崩溃,但是有一定的概率),后来换成了浏览器自己检测,加载页面
<body onorientationchange="jump();" style="overflow-x: hidden;">
jump()方法中使用 window.location.href 来进行页面,现在依然会崩溃(不是每次都会崩溃,但是有一定的概率),并且有时候还会有卡死的现象,请问该如何解决。多谢了。

2016-05-08 10:54 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复