Tabs
Tabs效果库
1) 示例截图:
2)html结构:
<div class="th-tabs" data-x-type="hummer-tabs/lib/index" data-x-config='{"effect":"leftright","interval":3000,"autoSwitch":"liner"}'>
<ul class="tab-navs fd-clr">
<li>导航1</li>
<li>导航2</li>
<li>导航3</li>
</ul>
<div class="tab-content">
<div class="tab-pane">
<img src="https://cbu01.alicdn.com/img/ibank/2015/500/382/2552283005_511594667.jpg"/>
</div>
<div class="tab-pane">
<img src="https://cbu01.alicdn.com/img/ibank/2015/880/991/2547199088_511594667.jpg"/>
</div>
<div class="tab-pane">
<img src="https://cbu01.alicdn.com/img/ibank/2015/460/202/2547202064_511594667.jpg"/>
</div>
</div>
<div class="pager">
<a class="previous"><上一页</a>
<a class="next">下一页></a>
</div>
</div>
3)css样式:
.th-tabs {
position: relative;
border: 1px solid #e5e5e5;
overflow: hidden;
width: 100%;
}
.th-tabs .tab-navs {
background: #e5e5e5;
text-align: center;
}
.th-tabs .tab-navs li {
float: left;
width: 33.33%;
cursor: pointer;
line-height: 20px;
padding: 6px;
}
.th-tabs .tab-navs li.active {
background: #fff;
}
.th-tabs .tab-navs img {
width: 100%;
}
.th-tabs .tab-content {
overflow: hidden;
}
.th-tabs .tab-content img {
width: 100%;
}
.th-tabs .pager {
position: absolute;
z-index: 20;
bottom: 5px;
right: 10px;
color: #00A000;
}
.th-tabs .pager .previous {
margin-right: 5px;
}
.th-tabs .pager .disabled {
color: #ccc;
}
4)配置参数:
配置名称 | 默认值 | 说明 |
---|---|---|
nav | '>.tab-navs>li' | 标签页选择器 |
pane | '>.tab-content>.tab-pane' | 标签内容页选择器 |
prev | '>.pager .previous' | 上一页选择器 |
next | '>.pager .next' | 下一页选择器 |
event | 'click' | 标签切和上下页的触发事件 |
effect | 'default' | "default":默认效果,"leftright":左右滚动,"fade":渐变 |
interval | 3000 | 自动切换时间间隔 |
duration | 300 | 切换动画时间 |
index | 0 | 当前显示的索引项 |
autoSwitch | false | 是否自动切换,'linear':顺序切换,'random':随机切换 |