欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery實(shí)現(xiàn)簡單的下拉菜單導(dǎo)航功能示例

 更新時間:2017年12月07日 11:23:14   作者:Shower稻草人  
這篇文章主要介紹了jQuery實(shí)現(xiàn)簡單的下拉菜單導(dǎo)航功能,涉及jQuery針對頁面元素的遍歷與節(jié)點(diǎn)修改相關(guān)操作技巧,需要的朋友可以參考下

本文實(shí)例講述了jQuery實(shí)現(xiàn)簡單的下拉菜單導(dǎo)航功能。分享給大家供大家參考,具體如下:

先來看看運(yùn)行效果:

具體代碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>www.dbjr.com.cn jQuery導(dǎo)航</title>
    <style type="text/css">
      #menu{width:300px;margin-left:auto;margin-right:auto;}.has_children{background:#555;color:#fff;cursor:pointer;}.highlight{color:#fff;background:green;}
      div{padding:0;}
      div a{background:#888;display:none;float:left;width:300px;}
    </style>
    <!-- 引入 jQuery -->
    <script src="jquery1.3.2.js" type="text/javascript"></script>
    <script type="text/javascript">
      //等待dom元素加載完畢.
    $(document).ready(function(){
        $(".has_children").click(function(){
          $(this).addClass("highlight")      //為當(dāng)前元素增加highlight類
          .children("a").show().end()      //將子節(jié)點(diǎn)的a元素顯示出來并重新定位到上次操作的元素
          .siblings().removeClass("highlight")    //獲取元素的兄弟元素,并去掉他們的highlight類
          .children("a").hide();        //將兄弟元素下的a元素隱藏
          });
        });
      </script>
  </head>
  <body>
    <div id="menu">
      <div class="has_children">
        <span>第1章-認(rèn)識jQuery</span>
        <a>1.1-JavaScript和JavaScript庫</a>
        <a>1.2-加入jQuery</a>
        <a>1.3-編寫簡單jQuery代碼</a>
        <a>1.4-jQuery對象和DOM對象</a>
        <a>1.5-解決jQuery和其它庫的沖突</a>
        <a>1.6-jQuery開發(fā)工具和插件</a>
        <a>1.7-小結(jié)</a>
      </div>
      <div class="has_children">
        <span>第2章-jQuery選擇器</span>
        <a>2.1-jQuery選擇器是什么</a>
        <a>2.2-jQuery選擇器的優(yōu)勢</a>
        <a>2.3-jQuery選擇器</a>
        <a>2.4-應(yīng)用jQuery改寫示例</a>
        <a>2.5-選擇器中的一些注意事項(xiàng)</a>
        <a>2.6-案例研究——類似淘寶網(wǎng)品牌列表的效果</a>
        <a>2.7-還有其它選擇器么?</a>
        <a>2.8-小結(jié)</a>
      </div>
      <div class="has_children">
        <span>第3章-jQuery中的DOM操作</span>
        <a>3.1-DOM操作的分類</a>
        <a>3.2-jQuery中的DOM操作</a>
        <a>3.3-案例研究——某網(wǎng)站超鏈接和圖片提示效果</a>
        <a>3.4-小結(jié)</a>
      </div>
    </div>
  </body>
</html>

更多關(guān)于jQuery相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《jQuery切換特效與技巧總結(jié)》、《jQuery擴(kuò)展技巧總結(jié)》、《jQuery常用插件及用法總結(jié)》、《jQuery拖拽特效與技巧總結(jié)》、《jQuery常見經(jīng)典特效匯總》、《jQuery動畫與特效用法總結(jié)》及《jquery選擇器用法總結(jié)

希望本文所述對大家jQuery程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評論