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

首頁 > 編程 > JavaScript > 正文

jQuery實現下拉菜單的實例代碼

2019-11-19 16:18:45
字體:
來源:轉載
供稿:網友

基本效果是這樣的~~

<!DOCTYPE html><html><head lang="en">  <meta charset="UTF-8">  <title></title>  <style type="text/css">    * {      margin: 0;      padding: 0;    }    ul {      list-style: none;    }    .wrap {      width: 330px;      height: 30px;      margin: 100px auto 0;      padding-left: 10px;      background-color: skyblue;    }    .wrap li {      background-color: skyblue;    }    .wrap > ul > li {      float: left;      margin-right: 10px;      position: relative;    }    .wrap a {      display: block;      height: 30px;      width: 100px;      text-decoration: none;      color: #000;      line-height: 30px;      text-align: center;    }    .wrap li ul {      position: absolute;      top: 30px;      display: none;    }  </style>  <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.js"></script>  <script>    $(function () {      //獲取所有li,添加移入事件      $(".wrap>ul>li").mouseenter(function () {        //設置內部的子元素ul slideDown        $(this).children("ul").stop().slideDown(600);      });      //移出li時,讓內部子元素slideUp      $(".wrap>ul>li").mouseleave(function () {        $(this).children("ul").stop().slideUp(600);      });      //如果當前運動沒有完畢,又添加了新的動畫,這時新的動畫需要等待當前動畫執行完畢才會開始      //如果持續添加。一定會造成動畫的積累,這種情況我們稱為動畫隊列    });  </script></head><body><div class="wrap">  <ul>    <li>      <a href="javascript:void(0);" 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" rel="external nofollow" >一級菜單1</a>      <ul class="ul">        <li><a href="javascript:void(0);" 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" rel="external nofollow" >二級菜單11</a></li>        <li><a href="javascript:void(0);" 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" rel="external nofollow" >二級菜單12</a></li>        <li><a href="javascript:void(0);" 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" rel="external nofollow" >二級菜單13</a></li>      </ul>    </li>    <li>      <a href="javascript:void(0);" 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" rel="external nofollow" >一級菜單2</a>      <ul>        <li><a href="javascript:void(0);" 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" rel="external nofollow" >二級菜單21</a></li>        <li><a href="javascript:void(0);" 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" rel="external nofollow" >二級菜單22</a></li>        <li><a href="javascript:void(0);" 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" rel="external nofollow" >二級菜單23</a></li>      </ul>    </li>    <li>      <a href="javascript:void(0);" 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" rel="external nofollow" >一級菜單3</a>      <ul>        <li><a href="javascript:void(0);" 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" rel="external nofollow" >二級菜單31</a></li>        <li><a href="javascript:void(0);" 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" rel="external nofollow" >二級菜單32</a></li>        <li><a href="javascript:void(0);" 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" rel="external nofollow" >二級菜單33</a></li>      </ul>    </li>  </ul></div></body></html>

以上所述是小編給大家介紹的jQuery實現下拉菜單的實例代碼,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對武林網網站的支持!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 澳门| 阳谷县| 石屏县| 西昌市| 内乡县| 东明县| 芷江| 泸溪县| 崇信县| 从江县| 体育| 上饶县| 万荣县| 集贤县| 门源| 三都| 禄丰县| 山西省| 昌江| 巴东县| 汨罗市| 南阳市| 永昌县| 城步| 郧西县| 扶余县| 花莲市| 繁昌县| 舟曲县| 通许县| 静安区| 黄冈市| 京山县| 达孜县| 宜兰县| 新安县| 博白县| 耿马| 勃利县| 浏阳市| 浏阳市|