国产99久久精品_欧美日本韩国一区二区_激情小说综合网_欧美一级二级视频_午夜av电影_日本久久精品视频

最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
當前位置: 首頁 - 科技 - 知識百科 - 正文

jquery實現二級導航下拉菜單效果實例

來源:懂視網 責編:小采 時間:2020-11-27 21:57:00
文檔

jquery實現二級導航下拉菜單效果實例

jquery實現二級導航下拉菜單效果實例:大家都知道jQuery是一個框架,它對JS進行了封裝,使其更方便使用。前面兩篇博文分別是用CSS樣式和JS實現的,那么這篇就用jQuery來實現二級下拉式菜單。 使用JQuery實現需要用到的知識有: 1)使用$(function(){...})獲取到想要作用的HTML元素。 2
推薦度:
導讀jquery實現二級導航下拉菜單效果實例:大家都知道jQuery是一個框架,它對JS進行了封裝,使其更方便使用。前面兩篇博文分別是用CSS樣式和JS實現的,那么這篇就用jQuery來實現二級下拉式菜單。 使用JQuery實現需要用到的知識有: 1)使用$(function(){...})獲取到想要作用的HTML元素。 2

大家都知道jQuery是一個框架,它對JS進行了封裝,使其更方便使用。前面兩篇博文分別是用CSS樣式和JS實現的,那么這篇就用jQuery來實現二級下拉式菜單。

使用JQuery實現需要用到的知識有:

  1. 1)使用$(function(){...})獲取到想要作用的HTML元素。
  2. 2)通過使用children()方法尋找子元素。
  3. 3)通過使用show()方法來顯示HTML元素。
  4. 4)通過使用hide()方法來隱藏HTML元素。
  5. 5)jQuery庫引用方法:

第一種方法:將jQuery庫下載到電腦上,然后引用,我下載的是jquery-1.7.1.min.js這個版本。

例如: 

<script type="text/javascript" src="jquery/jquery-1.7.1.min.js"></script>

第二種方法:直接引用在線服務器上的jQuery庫文件,比如谷歌服務器jQuery庫,百度服務器jQuery庫等。

例如:引用百度服務器上的jQuery庫文件

<script type="text/javascript" src="jquery/1.9.0/jquery.js"></script>

接下來看看制作的流程:

  1. 1、調用jQuery庫:編寫代碼,引用jquery庫。由于谷歌已退出大陸,建議使用百度服務器的jQuery庫。
  2. 注意: 百度服務器的jQuery庫地址:http://libs.baidu.com/jquery/1.9.0/jquery.js
  3. 2 、編寫顯示子菜單函數,使用$,并通過class名獲取一級菜單li,過children()找到li的孩子元素ul,使用show()方法,顯示二級菜單。
  4. 3、編寫隱藏子菜單函數,使用$,并通過class名獲取一級菜單li,過children()找到li的孩子元素ul,使用hide()方法, 隱藏二級菜單。
  5. 4、做瀏覽器兼容性測試,至少五個瀏覽器。IE7,8,9,火狐,谷歌,2345瀏覽器等。

先來看看效果圖:

最后我們來看看代碼的情況,和前面的區別不大:

HTML代碼:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html
xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta
http-equiv="Content-Type"
content="text/html; charset=gb2312" />

<title>下拉菜單</title>

<link
rel="stylesheet"
type="text/css"
href="style.css" rel="external nofollow" 
/>

<!--引用百度服務器的jQuery庫-->

<script
src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>

<script
type="text/javascript"
src="script.js"></script>

</head>

  

<body>

<div
id="nav"
class="nav">

  <ul>

    <li><a
href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >網站首頁</a></li>

   <li
class="navmenu"><a
href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >課程大廳</a>

    <ul>

     <li><a
href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >JavaScript</a></li>

     <li><a
href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >jQuery</a></li>

     <li><a
href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >Ajax</a></li>

    </ul>

   </li>

   <li
class="navmenu"><a
href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >學習中心</a>

    <ul>

     <li><a
href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >視頻學習</a></li>

     <li><a
href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >案例學習</a></li>

     <li><a
href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >交流平臺</a></li>

    </ul>

   </li>

   <li><a
href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >經典案例</a></li>

   <li><a
href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >關于我們</a></li>

  </ul>

</div>

</body>

</html>

CSS樣式表外部style.css文件代碼:

/*CSS全局設置*/

*{

 margin:0;

 padding:0;

}

.nav{

 background-color:#EEEEEE;

 height:40px;

 width:450px;

 margin:0
auto;

}

ul{

 list-style:none;

}

ul li{

 float:left;

 line-height:40px;

 text-align:center;

}

a{

 text-decoration:none;

 color:#000000;

 display:block;

 width:90px;

 height:40px;

}

a:hover{

 background-color:#666666;

 color:#FFFFFF;

}

ul li ul li{

 float:none;

 background-color:#EEEEEE;

}

ul li ul{

 display:none;

}

/*為了兼容IE7寫的CSS樣式,但是必須寫在a:hover前面*/

ul li ul li a:link,ul li ul li a:visited{

 background-color:#EEEEEE;

}

ul li ul li a:hover{

 background-color:#009933;

}

JS腳本外部script,js文件代碼:

$(function(){

  $(".navmenu").mouseover(function(){

   $(this).children("ul").show(); 

  })

   

  $(".navmenu").mouseout(function(){

   $(this).children("ul").hide();

  })

})

以上所述是小編給大家介紹的jquery二級導航下拉菜單詳解整合,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對腳本之家網站的支持!

聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

jquery實現二級導航下拉菜單效果實例

jquery實現二級導航下拉菜單效果實例:大家都知道jQuery是一個框架,它對JS進行了封裝,使其更方便使用。前面兩篇博文分別是用CSS樣式和JS實現的,那么這篇就用jQuery來實現二級下拉式菜單。 使用JQuery實現需要用到的知識有: 1)使用$(function(){...})獲取到想要作用的HTML元素。 2
推薦度:
標簽: 菜單 實現 效果
  • 熱門焦點

最新推薦

猜你喜歡

熱門推薦

專題
Top
主站蜘蛛池模板: 涩五月婷婷 | 国内在线观看精品免费视频 | 日韩欧美亚洲综合 | 一级毛片视频播放 | 国产精品美女流白浆视频 | 亚洲国产一区二区三区在线观看 | 精品一区二区三区视频日产 | 69视频高清完整版在线观看 | 99久久亚洲精品影院 | 久久国产影院 | 一区二区三区免费在线 | 可以免费观看一级毛片黄a 另类区 | 亚洲欧美国产另类 | 精品欧美在线 | 精品国产一区二区三区成人 | 久久久国产精品视频 | 日日综合| 国产精品久久二区三区色裕 | 91在线精品亚洲一区二区 | 婷婷综合在线 | 亚洲欧美天堂 | 一级毛片特级毛片免费的 | 日韩欧美伊人久久大香线蕉 | 久久se精品一区二区国产 | 国产一区二区三区视频 | 欧美高清一区二区三 | 亚欧美综合 | 亚洲视频五区 | 亚洲成人国产 | 国产不卡在线观看 | 国内精品线在线观看 | 国产一区二区三区视频在线观看 | 欧美日韩亚洲国产无线码 | 国产精品合集一区二区三区 | 国产黄色片一级 | 国产一级特黄aaaa大片野外 | 亚洲人成一区二区三区 | 欧美一级久久久久久久大片 | 久久久久久国产a免费观看黄色大片 | 精品久久一区二区 | 日韩手机视频 |