mui弹出菜单引入之后点击报错:Cannot read property 'offsetHeight' of null
代码:
<!-- 侧滑导航根容器 -->
<div class="mui-off-canvas-wrap mui-draggable mui-slide-in">
<!-- 菜单容器 -->
<aside class="mui-off-canvas-left">
<div class="">
<div class="mui-scroll mui-scroll-wrapper" id="offCanvasSideScroll">
<!-- 菜单具体展示内容 -->
<ul>
<li>1</li>
<li>1</li>
<li>1</li>
<li>1</li>
<li>1</li>
</ul>
</div>
</div>
</aside>
<!-- 主页面容器 -->
<div class="mui-inner-wrap mui-unactive">
<!-- 主页面标题 -->
<header class="mui-bar mui-bar-nav">
<a class="mui-icon mui-pull-left mui-icon-bars"></a>
<h1 class="mui-title">TEST</h1>
<!-- <a class="mui-icon mui-pull-right mui-icon-plus"></a> -->
<a href="#popover" id="openPopover" class="mui-icon mui-pull-right mui-icon-plus"></a>
</header>
<!-- 弹出菜单栏 -->
<div id="popover" class="mui-popover">
<ul class="mui-table-view mui-scroll-wrapper">
<li class="mui-table-view-cell"><a href="#">Item1</a></li>
<li class="mui-table-view-cell"><a href="#">Item2</a></li>
<li class="mui-table-view-cell"><a href="#">Item3</a></li>
<li class="mui-table-view-cell"><a href="#">Item4</a></li>
<li class="mui-table-view-cell"><a href="#">Item5</a></li>
<li class="mui-table-view-cell"><a href="#">Item1</a></li>
<li class="mui-table-view-cell"><a href="#">Item2</a></li>
<li class="mui-table-view-cell"><a href="#">Item3</a></li>
<li class="mui-table-view-cell"><a href="#">Item4</a></li>
<li class="mui-table-view-cell"><a href="#">Item5</a></li>
</ul>
</div>
<!-- 弹出菜单栏 -->
<div class="mui-content">
<div class="mui-scroll mui-scroll-wrapper" id="offCanvasContentScroll">
<!-- 主界面具体展示内容 -->
<ul>
<li>1</li>
</ul>
</div>
</div>
<nav class="mui-bar mui-bar-tab" id="nav">
<a id="tab_home" class="mui-tab-item mui-active" >
<span class="mui-icon mui-icon-home" ></span>
<span class="mui-tab-label">首页</span>
</a>
<a id="tab_message" class="mui-tab-item">
<span class="mui-icon mui-icon-email"></span>
<span class="mui-tab-label">消息</span>
</a>
<a id="tab_contact" class="mui-tab-item">
<span class="mui-icon mui-icon-contact"></span>
<span class="mui-tab-label">通讯录</span>
</a>
<a id="tab_setting" class="mui-tab-item" >
<span class="mui-icon mui-icon-gear"></span>
<span class="mui-tab-label">设置</span>
</a>
</nav>
<div class="mui-off-canvas-backdrop"></div>
</div>
</div>
<script src="./script/jquery-2.1.1.min.js" charset="utf-8"></script>
<script type="text/javascript" src="./script/api.js"></script>
<script src="./script/swiper-3.4.2.min.js" charset="utf-8"></script>
<script src="./script/mui.js" charset="utf-8"></script>
<script type="text/javascript">
apiready = function() {
};
// mui初始化
mui.init();
// 点击控制菜单滑动
$(".mui-icon-bars").on("tap",function(){
mui('.mui-off-canvas-wrap').offCanvas('show');
})
// 内容栏与菜单栏的内容都可以滚动显示
mui('#offCanvasSideScroll').scroll();
mui('#offCanvasContentScroll').scroll();
mui('#popover').scroll();
</script>
急!!!!!
1 个回复
suming1016
我也是这个问题,你是怎么解决的?