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

首頁 > 編程 > JavaScript > 正文

jquery實現鼠標滑過顯示二級下拉菜單效果

2019-11-20 11:44:15
字體:
來源:轉載
供稿:網友

本文實例講述了jquery實現鼠標滑過顯示二級下拉菜單效果。分享給大家供大家參考。具體如下:

這是一款jquery實現的下拉菜單,當鼠標移在主菜單上的時候,向下滑出二級子菜單,采用UL LI結構,便于修改完善,我覺得是很實用的菜單,希望大家平時能用得上。

運行效果截圖如下:

在線演示地址如下:

http://demo.VeVB.COm/js/2015/jquery-mouse-over-show-menu-codes/

具體代碼如下:

<!DOCTYPE html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>jquery下拉菜單</title><script type="text/javascript" src="jquery-1.6.2.min.js"></script><style>* { margin: 0; padding: 0; }body {font-family: Arial, Tahoma, sans-serif; font-size: 11px; color: #232323; }.wrap { width: 800px; margin: 0 auto; }#nav { margin: 0; padding: 0; list-style: none; border-left: 1px solid #d5dce8; border-right: 1px solid #d5dce8; border-bottom: 1px solid #d5dce8; border-bottom-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; height: 50px; padding-left: 15px; padding-right: 15px; background: #edf3f7; }#nav li { float: left; display: block; background: none; position: relative; z-index: 999; margin: 0 1px; }#nav li a { display: block; padding: 0; font-weight: 700; line-height: 50px; text-decoration: none; color: #818ba3; zoom: 1; border-left: 1px solid transparent; border-right: 1px solid transparent; padding: 0px 12px; }#nav li a:hover, #nav li a.hov { background-color: #fff; border-left: 1px solid #d5dce8; border-right: 1px solid #d5dce8; color: #576482; }#nav ul { position: absolute; left: 1px; display: none; margin: 0; padding: 0; list-style: none; -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.2); -o-box-shadow: 0 1px 3px rgba(0,0,0,0.2); box-shadow: 0 1px 3px rgba(0,0,0,0.2); -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.2); padding-bottom: 3px; }#nav ul li { width: 180px; float: left; border-top: 1px solid #fff; text-align: left; }#nav ul li:hover { border-left: 0px solid transparent; border-right: 0px solid transparent; }#nav ul a { display: block; height: 20px; line-height: 20px; padding: 8px 5px; color: #666; border-bottom: 1px solid transparent; text-transform: uppercase; color: #797979; font-weight: normal; }#nav ul a:hover { text-decoration: none; border-right-color: transparent; border-left-color: transparent; background: transparent; color: #4e4e4e; }* html #nav ul { margin: 0 0 0 -2px; }.clearfix:after { content: "."; display: block; clear: both; visibility: hidden; line-height: 0; height: 0; }.clearfix { display: inline-block; }html[xmlns] .clearfix { display: block; }* html .clearfix { height: 1%; }</style></head><body><div class="wrap"> <ul id="nav">  <li><a href="#">網站主頁</a></li>  <li><a href="#">關于我</a>   <ul>    <li><a href="#">Company</a></li>    <li><a href="#">Authors</a></li>    <li><a href="#">Advertising</a></li>   </ul>  </li>  <li><a href="#">RSS訂閱</a>   <ul>    <li><a href="#">PSD</a></li>    <li><a href="#">Patterns</a></li>    <li><a href="#">Icons</a></li>   </ul>     </li>  <li><a href="#">精美博文</a>   <ul>    <li><a href="#">HTML5</a></li>    <li><a href="#">CSS3</a></li>    <li><a href="#">jQuery</a></li>    <li><a href="#">MySQL</a></li>   </ul>  </li>  <li><a href="#">Web工具</a>   <ul>    <li><a href="#">Performance</a></li>    <li><a href="#">CMS Plugins</a></li>    <li><a href="#">Cheat Sheets</a></li>   </ul>  </li>  <li><a href="#">Originals</a>   <ul>    <li><a href="#">Website Design</a></li>    <li><a href="#">Mobile</a></li>   </ul>  </li> </ul></div><script type="text/javascript">$(document).ready(function() {  $('#nav li').hover(function() {  $('ul', this).slideDown(200);  $(this).children('a:first').addClass("hov"); }, function() {  $('ul', this).slideUp(100);  $(this).children('a:first').removeClass("hov");   });});</script></body></html>

希望本文所述對大家的jquery程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 广宁县| 章丘市| 景德镇市| 秀山| 英吉沙县| 雷州市| 桦甸市| 耒阳市| 娱乐| 平利县| 酒泉市| 新竹市| 阜阳市| 台北县| 新乡县| 霍林郭勒市| 德钦县| 潜山县| 和平区| 电白县| 临沧市| 南召县| 海口市| 宜兰县| 黔西| 涿鹿县| 蚌埠市| 孟州市| 禹州市| 新蔡县| 天门市| 南澳县| 成武县| 梅州市| 长岭县| 囊谦县| 临桂县| 辽宁省| 措美县| 仪征市| 肃宁县|