国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

用jQuery實現一些導航條切換,顯示隱藏的實例代碼

2019-11-20 22:39:36
字體:
來源:轉載
供稿:網友

代碼如下:

復制代碼 代碼如下:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>導航條在項目中的應用</title>
    <script language="javascript" type="text/javascript" src="Jscript/jquery-1.4.2.min.js"></script>
   <script type="text/javascript">
       $(function(){
            $(".tit").find("span").click(function(){
                $(this).toggleClass("closeBtn2").parent().next().slideToggle();  //實現內容隱藏顯示,及圖標的切換
                 }) ;
           $(".clsBot").click(function(){
               $(this).parent().find("li:gt(4)").toggle();      //實現內容索引值大于4的隱藏或者顯示

           })
       })
   </script>
    <style type="text/css">
        *{ margin: 0;padding: 0;}
        ul li{ list-style: none;}
        .box{ width: 400px; margin: 100px auto; border: 1px solid #ddd;}
        .tit{ background: #999; height: 30px; color: #fff; font-size: 14px; line-height: 30px; padding-left: 6px; position: relative;}
        .closeBtn{ background: url("Images/a2.gif") no-repeat 0 0; width: 7px; height: 8px; position: absolute; right: 10px; top: 10px; display: block; text-indent: -9999px; cursor: pointer;}
         .closeBtn2{background: url("Images/a1.gif") no-repeat 0 0;}
          .content{padding: 6px;font-size: 12px; overflow: hidden; }
        .content li{ float: left; width: 100px; height: 24px; }
        .content li a{ color: #999;}
        .content li a:hover{ color: red;}
        .clsBot{ display: block; clear: both; background: url("Images/a5.gif") no-repeat right 0; padding-right: 16px; float: right; width: 26px; cursor: pointer; color: blue;}
    </style>
</head>
<body>
    <div class="box">
        <div class="tit">
            <h2>圖書分類</h2>
            <span class="closeBtn">關閉</span>
        </div>
        <div class="content">
            <ul>
                <li><a href="#">小說</a><i> ( 1110 ) </i></li>
                <li><a href="#">文藝</a><i> ( 230 ) </i></li>
                <li><a href="#">青春</a><i> ( 1430 ) </i></li>
                <li><a href="#">少兒</a><i> ( 1560 ) </i></li>
                <li><a href="#">生活</a><i> ( 870 ) </i></li>
                <li><a href="#">社科</a><i> ( 1460 ) </i></li>
                <li><a href="#">管理</a><i> ( 1450 ) </i></li>
                <li><a href="#">計算機</a><i> ( 1780 ) </i></li>
                <li><a href="#">教育</a><i> ( 930 ) </i></li>
                <li><a href="#">工具書</a><i> ( 3450 ) </i></li>
                <li><a href="#">引進版</a><i> ( 980 ) </i></li>
                <li><a href="#">其它類</a><i> ( 3230 ) </i></li>
            </ul>
            <span class="clsBot">簡化</span>
        </div>
    </div>
</body>
</html>

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 富民县| 合阳县| 仁寿县| 农安县| 宁阳县| 门源| 丘北县| 博爱县| 竹山县| 酉阳| 台中县| 博兴县| 兴海县| 建昌县| 庆元县| 金堂县| 东海县| 睢宁县| 巴林左旗| 三明市| 全州县| 茶陵县| 临清市| 新乐市| 上杭县| 密云县| 绥棱县| 那坡县| 泾源县| 高阳县| 营山县| 怀安县| 政和县| 蛟河市| 太湖县| 伊宁县| 雅安市| 房产| 东宁县| 三江| 泾阳县|