jQuery实现移动端Tab选项卡效果
更新时间:2017年03月15日 11:07:46 作者:艾米
本篇文章主要介绍了jQuery实现移动端Tab选项卡效果的实例。具有很好的参考价值。下面跟着小编一起来看下吧
效果图:
代码如下:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> <title>移动端Tab选项卡</title> <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script> <script> $(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(); }); }) </script> <style> *{ 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%; } </style> </head> <body> <div class="nav"> <div class="tab border-b"> <a href="javascript:;" rel="external nofollow" rel="external nofollow" class="curr">商品介绍</a> <a href="javascript:;" rel="external nofollow" rel="external nofollow" >评价(99)</a> </div> <div class="content"> <ul> <li style="display: block">商品介绍</li> <li>评价</li> </ul> </div> </div> </body> </html>
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持脚本之家!
相关文章
jquery jqPlot API 中文使用教程(非常强大的图表工具)
这里贡献上中文教程,基本上所有的api都很齐全,供有需要的童鞋们瞧瞧,更重要的是作为自己滴收藏2011-08-08Jquery检验手机号是否符合规则并根据手机号检测结果将提交按钮设为不同状态
接了个项目做,需要是这样的:输入手机号,实时判断输入的手机号是否符合规则,如果不符合怎么处理,符合又怎么处理等一系列问题,本篇文章给大家介绍Jquery检验手机号是否符合规则并根据手机号检测结果将提交按钮设为不同状态,感兴趣的朋友参考下2015-11-11如何使用jQuery Draggable和Droppable实现拖拽功能
本篇文章是对使用jQuery Draggable和Droppable实现拖拽功能的方法进行了详细的分析介绍,需要的朋友参考下2013-07-07基于jquery的inputlimiter 实现字数限制功能
因客户要求区分全角跟半角,所以在jquery.inputlimiter.js插件上还做了些小改动。2010-05-05
最新评论