请问这怎么解决

- 发布:2017-12-20 09:48
- 更新:2017-12-20 12:18
- 阅读:1336


复制代码// 监听设备是否横竖屏
window.addEventListener('resize', function(e) {
var orientation = window.orientation,
width = window.innerWidth;
if(orientation == 0 || orientation == 180) {
//竖屏
leftPos = Math.ceil((window.innerWidth - 60) / 2);
drawNativeIcon.setStyle({
bottom: '5px',
left: leftPos + 'px',
width: '60px',
height: '60px'
});
} else if(orientation == 90 || orientation == -90) {
// 横屏
leftPos = Math.ceil((window.innerWidth - 60) / 2);
drawNativeIcon.setStyle({
bottom: '5px',
left: leftPos + 'px',
width: '60px',
height: '60px'
});
}
});
-
-
下雨咯 (作者)
回复 n***@gmail.com:大佬,这个监听很有效,虽然M图标的坐标没有问题了,但是tabbar和页面不对应,甚至第二个tabbar不能点击。 另外我试了你更新在GitHub上的代码,效果依然如我所说,我觉得大佬你可能只把重点放在M上了 没有去试着点一下其他的tabbar。期待回复。
2017-12-21 16:49