设为首页收藏本站关注微信<<< 抵制 IE6 人人有责 >>>
搜索
热搜: 活动 交友 discuz
查看: 1868|回复: 0
打印 上一主题 下一主题

[Html] 代码简洁的滑动门(tab)jquery插件

[复制链接]
跳转到指定楼层
楼主
发表于 2015-1-4 18:45:12 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  5. <title>代码简洁的滑动门(tab)jquery插件 - Kevin-ying</title>
  6. <meta name="keywords" content="jquery特效,JS代码,js特效代码大全,导航菜单代码,焦点幻灯片,企业网页设计欣赏" />
  7. <meta name="description" content="Kevin-ying为您提供-基于jquery特效,jquery弹出层效果,js特效代码大全,JS广告代码,导航菜单代码,下拉菜单代码和jquery焦点图片代码。" />

  8. <style type="text/css">
  9. body,ul,li{margin: 0;padding: 0;font: 12px normal "宋体", Arial, Helvetica, sans-serif;list-style: none;}
  10. a{text-decoration: none;color: #000;font-size: 14px;}

  11. #tabbox{ width:600px; overflow:hidden; margin:0 auto;}
  12. .tab_conbox{border: 1px solid #999;border-top: none;}
  13. .tab_con{ display:none;}

  14. .tabs{height: 32px;border-bottom:1px solid #999;border-left: 1px solid #999;width: 100%;}
  15. .tabs li{height:31px;line-height:31px;float:left;border:1px solid #999;border-left:none;margin-bottom: -1px;background: #e0e0e0;overflow: hidden;position: relative;}
  16. .tabs li a {display: block;padding: 0 20px;border: 1px solid #fff;outline: none;}
  17. .tabs li a:hover {background: #ccc;}   
  18. .tabs .thistab,.tabs .thistab a:hover{background: #fff;border-bottom: 1px solid #fff;}

  19. .tab_con {padding:12px;font-size: 14px; line-height:175%;}
  20. </style>
  21. <script src="js/jquery.min.js" type="text/javascript"></script>
  22. <script type="text/javascript">
  23. $(document).ready(function() {
  24.     jQuery.jqtab = function(tabtit,tabcon) {
  25.         $(tabcon).hide();
  26.         $(tabtit+" li:first").addClass("thistab").show();
  27.         $(tabcon+":first").show();
  28.    
  29.         $(tabtit+" li").click(function() {
  30.             $(tabtit+" li").removeClass("thistab");
  31.             $(this).addClass("thistab");
  32.             $(tabcon).hide();
  33.             var activeTab = $(this).find("a").attr("tab");
  34.             $("#"+activeTab).fadeIn();
  35.             return false;
  36.         });
  37.         
  38.     };
  39.     /*调用方法如下:*/
  40.     $.jqtab("#tabs",".tab_con");
  41.    
  42. });
  43. </script>
  44. </head>
  45. <body>
  46. <div id="tabbox">

  47.     <ul class="tabs" id="tabs">
  48.        <li><a href="http://www.kevin-ying.com/js/nav/" tab="tab1">导航菜单</a></li>
  49.        <li><a href="http://www.kevin-ying.com/js/slide/" tab="tab2">焦点幻灯片</a></li>
  50.        <li><a href="http://www.kevin-ying.com/js/gg/" tab="tab3">广告代码</a></li>
  51.        <li><a href="http://www.kevin-ying.com/js/texiao/" tab="tab4">网页特效</a></li>
  52.     </ul>
  53.     <ul class="tab_conbox">
  54.         <li id="tab1" class="tab_con">
  55.            <p><span><a href="http://www.kevin-ying.com/">Kevin-ying</a>只收录实用和能提高用户体验的代码</span><br />
  56. <span>我们只想解放出你的部分写代码时间来思考更高层次的设计,而不是要你懒惰、拼凑。</span></p>
  57.         </li>
  58.             
  59.         <li id="tab2" class="tab_con">
  60.             <p><span><a href="http://www.kevin-ying.com/">Kevin-ying</a>只收录实用和能提高用户体验的代码</span><br />
  61. <span>我们只想解放出你的部分写代码时间来思考更高层次的设计,而不是要你懒惰、拼凑。</span></p>
  62.         </li>
  63.    
  64.         <li id="tab3" class="tab_con">
  65.             <p><span><a href="http://www.kevin-ying.com/">Kevin-ying</a>只收录实用和能提高用户体验的代码</span><br />
  66. <span>我们只想解放出你的部分写代码时间来思考更高层次的设计,而不是要你懒惰、拼凑。</span></p>
  67.         </li>
  68.    
  69.         <li id="tab4" class="tab_con">
  70.             <p><span><a href="http://www.kevin-ying.com/">Kevin-ying</a>只收录实用和能提高用户体验的代码</span><br />
  71. <span>我们只想解放出你的部分写代码时间来思考更高层次的设计,而不是要你懒惰、拼凑。</span></p>
  72.         </li>
  73.     </ul>
  74.    
  75. </div>
  76. <p>代码简洁的滑动门(tab)jquery插件调用方法:"#tabs",".tab_con" 这里的#tabs是jquery选项卡的链接按钮的外层ID,.tab_con是要显示的的内容类名。只要注意这两个地方调用就不会错。一个页面可以多次使用。
  77. </p>

  78. <!--下面只是说明与程序代码无关-->
  79. <div style="width:95%; height:auto; display:block; margin:0 auto; margin-top:30px; font-size:10pt; line-height:150%;">
  80. <span>本代码由<a href="http://www.51xuediannao.com" style="color:#F00;">Kevin-Ying 收集整理  </a> </span><br>
  81. <a href="http://www.kevin-ying.com/">Kevin-ying http://www.kevin-ying.com/</a><br /><br/>

  82. <span> 、我们为您提供-
  83. <a href="http://www.kevin-ying.com/html+css/">html+css</a>,
  84. <a href="http://www.kevin-ying.com/js/">jquery特效</a>,
  85. <a href="http://www.kevin-ying.com/js/">JS代码</a>,
  86. <a href="http://www.kevin-ying.com/js/texiao/">网页特效</a>,
  87. <a href="http://www.kevin-ying.com/js/nav/">导航菜单</a>,
  88. <a href="http://www.kevin-ying.com/js/slide/">焦点幻灯片</a>,
  89. </span> <br />
  90. <span>Kevin-ying只收录实用和能提高用户体验的代码</span><br />
  91. <span>我们只想解放出你的部分写代码时间来思考更高层次的设计,而不是要你懒惰、拼凑。</span>
  92. </div>
  93. </body>
  94. </html>
复制代码


JS在附件內:
游客,如果您要查看本帖隐藏内容请回复


分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 转播转播 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

QQ|手机版|Archiver|源于生活(个人生活娱乐工作的笔记)css3,html5,学习笔记    

GMT+8, 2024-4-28 12:38 , Processed in 0.109200 second(s), 27 queries .

Powered by Mr.Kevin-ying

© 2004-2015

快速回复 返回顶部 返回列表