最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
jQuery实现移动端Tab选项卡效果
时间:2017-06-29 编辑:简简单单 来源:一聚教程网
效果图:
代码如下:
代码如下 | 复制代码 |
$(function() { $(".tab a").click(function() { $(this).addClass('curr').siblings().removeClass('curr'); var index = $(this).index(); number = index; $('.nav .content li').hide(); $('.nav .content li:eq(' + index + ')').show(); }); })
*{ margin: 0; padding: 0; } div, input, textarea, button, a { -webkit-tap-highlight-color: rgba(0,0,0,0); } ul, li, ol{ list-style: none; } a { color: #323232; outline-style: none; text-decoration: none; } .border-b { position: relative; } .border-b:after { top: auto; bottom: 0; } .border-t:before, .border-b:after { content: ''; position: absolute; left: 0; background: #ddd; right: 0; height: 1px; -webkit-transform: scaleY(0.5); transform: scaleY(0.5); -webkit-transform-origin: 0 0; transform-origin: 0 0; } .nav { background-color: #fff; text-align: center; } .nav .tab { width: 100%; position: relative; overflow: hidden; } .tab a { float: left; width: 49%; height: 2.56rem; line-height:2.56rem; display: inline-block; border-right: 1px solid #e1e1e1; } .tab a:last-child { border-right: 0; } .tab .curr { border-bottom: 2px solid #fc7831; color: #fc7831; } .content ul li { display: none; padding: 3%; width: 94%; }
|