让weui和iscroll结婚
结合我们之前讲的移动端特点
- header
- content(#wrapper)
- footer
也就是说我们可以这样做
<div class="page">
<div class="hd header">
<h1 class="page_title">WeUI</h1>
</div>
<div class="bd" id="wrapper">
</div>
<div class="hd footer">
<h1 class="page_title">WeUI</h1>
</div>
</div>
</div>
我们先把helloiscroll里的内容放进去
WeUI
去掉 class=”page_title”
不能滑动,添加js就好了
修改iscroll2.css
position: absolute;
z-index: 2;
left: 0;
width: 100%;
height: 45px;
line-height: 45px;
background: #CD235C;
padding: 0;
color: #eee;
font-size: 20px;
text-align: center;
font-weight: bold;
}
#wrapper {
position: absolute;
z-index: 1;
top: 48px;/*m*/
bottom: 0px; /*m*/
width: 100%;
background: #ccc;
overflow: hidden;
}
下面开始集成点击进入按钮页面
看一下按钮是如何定义和响应的
<a class="weui_cell js_cell" href="javascript:;" data-id="button">
<span class="weui_cell_hd">
<img src="/images/icon_nav_button.png" class="icon_nav" alt=""></span>
<div class="weui_cell_bd weui_cell_primary">
<p>Button</p>
</div>
<div class="weui_cell_ft">
</div>
</a>
放到第一个li里
此时不能点击,nnd,这是怎么回事儿呢?
各位想想之前讲iscroll的时候,是不是有点注意事项啊?
翻查一下代码,确实没加click(其实是为了演示故意的)
加上,再次预览
很明显是z-index问题,翻查iscroll2.css里发现#wrapper是z-index:1
而.page没有设置,简单改一下即可
<style>
.page{
z-index: 2;
</style>
是时候去加上weui其他效果了
- li上增加按钮