码迷,mamicode.com
首页 > Web开发 > 详细

jquery之下拉菜单

时间:2017-07-22 10:51:30      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:nav   .sh   class   标题   images   lock   jquer   javascrip   src   

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2 <html xmlns="http://www.w3.org/1999/xhtml">
 3 <head>
 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5 <title>无标题文档</title>
 6 <style type="text/css">
 7 *{ margin:0px; padding:0px;}
 8  #menu{ background-color:#eee; width:600px; height:40px; margin:0 auto;}
 9  ul{ list-style:none;}
10  ul li{ float:left;  line-height:40px; text-align:center; position:relative;}
11  a{ text-decoration:none; color:#000; display:block; width:90px;}
12  a:hover{ color:#FFF; background-color:#666;}
13  ul li ul li{ float:none; border-left:none; margin-top:2px; background-color:#eee; } 
14  ul li ul{  width:90px; position:absolute; left:0px; top:40px; display:none;}
15  
16 </style>
17 <script src="js/jquery.1.9.1.js"></script>
18 
19 <script type="text/javascript">
20   $(function(){
21      $(".navmenu").mouseover(function(){
22          $(this).children("ul").show();
23          
24          
25          })
26      $(".navmenu").mouseout(function(){
27          
28          $(this).children("ul").hide();
29          
30          })
31       
32       })
33   
34 </script>
35 
36 </head>
37 
38 <body>
39 <div id="menu">
40    <ul>
41    
42   <li><a href="#">首页</a></li>
43   <li class="navmenu"><a href="#">课程大厅</a>
44       <ul>  
45          <li><a href="#">JavaScript</a></li>
46          <li><a href="#">jQuery</a></li>
47       </ul>
48   
49   </li>
50   <li class="navmenu"><a href="#">学习中心</a>
51       <ul>
52          <li><a href="#">视频学习</a></li>
53          <li><a href="#">案例学习</a></li>
54          <li><a href="#">交流平台</a></li>
55       </ul>
56   </li>
57   <li><a href="#">经典案例</a></li>
58   <li><a href="#">关于我们</a></li>
59   
60 </ul>
61 
62 
63 </div> 
64           </body>
65 </html>

效果图:

技术分享

 

jquery之下拉菜单

标签:nav   .sh   class   标题   images   lock   jquer   javascrip   src   

原文地址:http://www.cnblogs.com/youbiao/p/7220388.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!