Html
    Css
    Js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<div class="nav">
<div class="nav-main">
<h4></h4>
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
<div class="nav-main">
<h4></h4>
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
<div class="nav-main">
<h4></h4>
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
<div class="nav-main">
<h4></h4>
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
</div>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
* {
margin:0;
padding:0;
}
li {
list-style:none
}
.nav {
width:400px;
height:40px;
background-color:#30ea70;
margin:100px auto;
}
.nav div {
float:left;
text-align:center;
width:25%;
height:100%;
}
.nav .nav-main h4 {
width:100%;
height:100%;
line-height:40px;
text-align:center;
color:#fff;
}
.nav .nav-main ul {
width:100%;
height:400%;
/* background-color:#eee;
*/
display:none;
}
.nav .nav-main:hover {
background-color:pink;
}
.nav .nav-main:first-child ul {
background-color:red;
}
.nav .nav-main:nth-of-type(2) ul {
background-color:green;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
$(function() {
var tab = $(".nav .nav-main");
tab.mouseover(function(event) {
$(this).find("ul").stop();
$(this).find("ul").slideDown();
}).mouseout(function(event) {
$(this).find("ul").stop();
$(this).find("ul").slideUp();
});;
})
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
↑上面代码改变,会自动显示代码结果 jQuery调用版本:1.11.3
 立即下载

jQuery下拉菜单

主要运用jquery滑入滑出的方法

2
      风雪殇0
      2018/8/3 13:14:54
      爱是如此深辰0
      2017/12/8 13:25:05