2***@qq.com
2***@qq.com
  • 发布:2016-08-24 15:34
  • 更新:2017-03-27 14:47
  • 阅读:1138

使用索引列表页面为什么会出现页面不能铺满窗口?

分类:MUI
mui
        mui.ready(function() {  

            var header = document.querySelector('header.mui-bar');  
            var list = document.getElementById('list');  
            //calc hieght  
            list.style.height = (document.body.offsetHeight - header.offsetHeight) + 'px';  
            alert(document.body.offsetHeight);  
            alert(header.offsetHeight);  
            //create  
            window.indexedList = new mui.IndexedList(list);  

        });  

这是官方示例源码,有时会出现不能索引页面不能铺满窗口区域现象。查看发现是document.body.offsetHeight值为0,怎么解决?

2016-08-24 15:34 2 条评论 负责人:无 分享
已邀请:
2***@qq.com

2***@qq.com (作者)

原因好像是webview是HIDE隐藏的?所以offsetheight为0........................求教怎么解决?用的模板tabbar webview模式,一个4个选项卡,4个页面。。。其中一个加载索引列表页(非首页main页)。模板在加载4个子页面时,应该对其他3个页面隐藏了。。。造成加载索引列表页时读取document.body.offsetHeight值为0。求个解决方法!

Trust

Trust - 少说废话

请上传一个可重现问题的示例工程。

MS橘子小姐

MS橘子小姐

我也遇到同样问题了。。。楼主解决了吗?

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