zoukankan      html  css  js  c++  java
  • jQuery实现简单的tab切换

    <!doctype html>

     <html>

     <head>

     <meta charset="gb2312">

     <meta http-equiv="X-UA-Compatible" content="IE=7">

     <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

     <script type="text/javascript">

         $(function(){

             $(".menu a").click(function(){

                 $(this).addClass("curr").siblings().removeClass("curr");

                 $(".text div").eq($(this).index()).show().siblings().hide();

             });

         });

     </script>

     <title>简单的tab切换</title>

     <style>

     *{margin:0;padding:0}

     .menu{500px;margin:20px auto}

     .menu a{display:inline-block;100px;height:35px;line-height:35px;text-align:center;color:#000;background:#ccc}

     .menu a.curr{background:#06f;color:#fff;font-weight:bold}

     .text{480px;height:170px;padding:10px;font-size:20px;border:1px solid #ccc}

     .hide{display:none}

     </style>

     </head>

     

     <body>

     <div class="menu">

         <a href="javascript:;" class="curr">Tab1</a>

         <a href="javascript:;">Tab2</a>

         <a href="javascript:;">Tab3</a>

         <a href="javascript:;">Tab4</a>

         <div class="text">

             <div>我是内容1111111111我是内容111111111</div>

             <div class="hide">我是内容2222222222我是内容2222222222</div>

             <div class="hide">我是内容33333333我是内容33333333</div>

             <div class="hide">我是内容444444444我是内容44444444</div>

         </div>

     </div>

     </body>

     </html>

  • 相关阅读:
    Ucenter会员整合
    站点收藏
    天天团购整理笔记一
    MSSQLSERVER 时间差计算
    shell 编程实例练习(一)
    Linux PCI 设备驱动基本框架(二)
    Shell grep / sed 学习
    转:Python自省(反射)指南
    Shell 数组与双括号
    Python基本数据生成
  • 原文地址:https://www.cnblogs.com/douqiumiao/p/2755702.html
Copyright © 2011-2022 走看看