"Bootstrap Dropdown Menu with mobile animation"
Bootstrap 3.0.0 Snippet by mani88100ni

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
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<nav class="navbar-default">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-menu">
<i class="fa fa-bars"></i>
</button>
</div>
<div class="collapse navbar-collapse" id="navbar-menu">
<ul class="nav navbar-nav mobile-menu">
<li> <a href="#!">Home</a> <span class="has-dropdown"></span>
<ul class="dropdown-menu">
<li> <a href="#">Home Page 1</a> </li>
<li> <a href="#">Home Page 2</a> </li>
<li> <a href="#">Home Page 3</a> </li>
<li> <a href="#">Home Page 4</a> </li>
<li> <a href="#">Home Page 5</a> </li>
</ul>
</li>
<li> <a href="#!">About us</a> <span class="has-dropdown"></span>
<ul class="dropdown-menu">
<li> <a href="#">About</a> </li>
<li> <a href="#">About 2</a> </li>
<li> <a href="#">About 3</a> </li>
<li> <a href="#">history</a> </li>
<li> <a href="#">career</a> </li>
<li> <a href="#">partnerships</a> </li>
<li> <a href="#">leadership</a> </li>
</ul>
</li>
<li> <a href="javascript:avoid(0);">services</a> <span class="has-dropdown"></span>
<ul class="dropdown-menu">
<li>
<a href="#">Services</a>
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
@media (min-width: 1024px) {
.navbar-default ul.nav > li > a:hover,
.navbar-default ul.nav > li > a:focus{
color: #fd9b28;
}
.navbar-default ul.nav > li.dropdown > a:after {
font-family: 'FontAwesome';
content: "\f0d7";
margin-left: 5px;
margin-top: 2px;
}
.navbar-default li.dropdown ul.dropdown-menu {
-moz-box-shadow: 0px 0px 0px;
-webkit-box-shadow: 0px 0px 0px;
-o-box-shadow: 0px 0px 0px;
box-shadow: 0px 0px 0px;
-moz-border-radius: 0px;
-webkit-border-radius: 0px;
-o-border-radius: 0px;
border-radius: 0px;
padding: 0;
width: 200px;
background: #fff;
border: solid 1px #e0e0e0;
border-top: solid 5px;
}
.navbar-default li.dropdown ul.dropdown-menu > li a:hover,
.navbar-default li.dropdown ul.dropdown-menu > li a:hover {
background-color: transparent;
}
.navbar-default li.dropdown ul.dropdown-menu > li > a {
padding: 10px 15px;
border-bottom: solid 1px #eee;
color: #6f6f6f;
}
.navbar-default li.dropdown ul.dropdown-menu > li:last-child > a {
border-bottom: none;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
$(".mobile-menu> li >a").click(function(){
if ($(window).width() <= 991) {
$('.mobile-menu> li').removeClass('on');
$('.mobile-menu> li> ul').slideUp('normal');
if ($(this).next().next('ul').is(':hidden') === true) {
$(this).parent('li').addClass('on');
$(this).next().next('ul').slideDown('normal');
}
}
});
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: