"Double navbar with search"
Bootstrap 4.1.1 Snippet by superbwebdeveloper

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="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<header class="topbar">
<div class="container">
<!--=========-TOP_BAR============-->
<nav class="topBar">
<div class="container">
<ul class="topBarNav float-right">
<li>
<div class=" d-sm-block">
<a href="#"><i class="fa fa-facebook"></i></a>
<a href="#"><i class="fa fa-twitter"></i></a>
<a href="#"><i class="fa fa-youtube"></i></a>
<a href="#"><i class="fa fa-instagram"></i></a>
<a href="#"><i class="fa fa-pinterest"></i></a>
</div>
</li>
</ul>
</div>
</nav>
<!--=========-TOP_BAR============-->
<nav class="navbar navbar-expand-lg navbar-dark navbar-bootsnipp animate">
<a class="navbar-brand" href="index.html">
<img src="https://via.placeholder.com/150" alt="Logo" align="center" />
</a>
<!-- Toggler/collapsibe Button -->
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<!-- Links -->
<div class="collapse navbar-collapse" id="collapsibleNavbar">
<ul class="navbar-nav ml-auto">
<li class="d-xl-none d-lg-none search-block">
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
img {
max-width: 100%;
}
ul{
list-style: none;
}
.topbar {
background-color: #0d6990;
}
.topBarNav .fa {
color: white;
}
.search-btn {
color: #fff;
background-color: #e5a125;
border-color: #e5a125;
}
.search-btn:hover {
color: #fff;
background-color: #e6a630;
border-color: #e6a630;
}
.search-form input::-webkit-input-placeholder {
/* Edge */
color: #FFFFFF;
}
.search-form input:-ms-input-placeholder {
/* Internet Explorer 10-11 */
color: #FFFFFF;
}
.search-form input::placeholder {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$(document).ready(function () {
$('a[href="#toggle-search"], .search-btn[type="reset"]').on('click', function (event) {
event.preventDefault();
$('.search-keyword').val('');
$('.bootsnipp-search').toggleClass('open');
$('a[href="#toggle-search"]').closest('li').toggleClass('active');
if ($('.navbar-bootsnipp .bootsnipp-search').hasClass('open')) {
/* I think .focus dosen't like css animations, set timeout to make sure input gets focus */
setTimeout(function () {
$('.bootsnipp-search .form-control').focus();
}, 100);
}
});
$(document).on('keyup', function (event) {
if (event.which == 27 && $(' .bootsnipp-search').hasClass('open')) {
$('a[href="#toggle-search"]').trigger('click');
}
});
});
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: