jQuery移动端Tab选项卡效果实现方法
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了jQuery移动端Tab选项卡效果实现方法,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2106字,纯文字阅读大概需要4分钟。
内容图文
tab选项卡功能我们也会经常接触,本文我们主要介绍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; } p, 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> <p class="nav"> <p 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> </p> <p class="content"> <ul> <li style="display: block">商品介绍</li> <li>评价</li> </ul> </p> </p> </body> </html>
大家学会了吗?赶紧动手尝试一下吧。
相关推荐:
JavaScript插件Tab选项卡详解
layui选项卡效果实现代码
jquery实现tab选项卡切换效果
以上就是jQuery移动端Tab选项卡效果实现方法的详细内容,更多请关注Gxl网其它相关文章!
内容总结
以上是互联网集市为您收集整理的jQuery移动端Tab选项卡效果实现方法全部内容,希望文章能够帮你解决jQuery移动端Tab选项卡效果实现方法所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。