"Inline Navbar Search"
Bootstrap 3.1.0 Snippet by gango

<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.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 navbar-default" role="navigation"> <div class="container"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#"></a> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <li class="nav navbar-nav"> <a href="#" class="navbar-brand"> <img src="logo.png" style="max-height:100%;"></a> </li> <li class="active"><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="#">Action</a></li> <li><a href="#">Another action</a></li> <li><a href="#">Something else here</a></li> <li class="divider"></li> <li><a href="#">Separated link</a></li> <li class="divider"></li> <li><a href="#">One more separated link</a></li> </ul> </li> <li class="dropdown dropdown-large"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Ürünler <b class="caret"></b></a> <ul class="dropdown-menu dropdown-menu-large row" style="width:97%;"> <li class="col-md-2 col-sm-12"> <ul> <li class="dropdown-header"><h3>New</h3></li> <li class="divider"></li> <li><a href="#">Available glyphs</a></li> <li class="disabled"><a href="#">How to use</a></li> <li><a href="#">Examples</a></li> <li class="divider"></li> <li class="dropdown-header">Dropdowns</li> <li><a href="#">Example</a></li> <li><a href="#">Aligninment options</a></li> <li><a href="#">Headers</a></li> <li><a href="#">Disabled menu items</a></li> </ul> </li> <li class="col-md-8 col-sm-12"> <ul> <li class="dropdown-header"><h3>Product Categories</h3></li> <li class="divider"></li> <li class="col-md-4 col-sm-4"> <ul style="padding-left:0px;"> <li><a href="#">Basic example</a></li> <li><a href="#">Button toolbar</a></li> <li class="divider"></li> <li><a href="#">Sizing</a></li> <li><a href="#">Nesting</a></li> <li><a href="#">Vertical variation</a></li> </ul> </li> <li class="divider"></li> <li class="col-md-4 col-sm-4"> <ul style="padding-left:0px;"> <li><a href="#">Basic example</a></li> <li><a href="#">Button toolbar</a></li> <li><a href="#">Sizing</a></li> <li><a href="#">Nesting</a></li> <li><a href="#">Vertical variation</a></li> </ul> </li> <li class="divider"></li> <li class="col-md-4 col-sm-4"> <ul style="padding-left:0px;"> <li><a href="#">Basic example</a></li> <li><a href="#">Button toolbar</a></li> <li><a href="#">Sizing</a></li> <li><a href="#">Nesting</a></li> <li><a href="#">Vertical variation</a></li> </ul> </li> </ul> <div style=""> <h4 style="text-align:right; margin:20px; color:#333;"><a href="#" style="color:#333;"> Tumasd asd </a></h4> </div> </li> <li class="col-md-2 col-sm-12"> <ul style="text-align:center;"> <li class="dropdown-header"><h3 style="text-align: left; margin-left: -10px; max-width: 100%;">Manufacturers</h3></li> <li class="divider"></li> <li><a href="#"><img style=" max-width: 100%;width: auto; height: 90px;" src="http://placehold.it/800x500"></a><h4>123123123 asdasd</h4></li> <li class="divider"></li> <li><a href="#"><img style=" max-width: 100%;width: auto; height: 90px;" src="http://placehold.it/800x500"></a><h4>123123123 asdasd</h4></li> <li class="divider"></li> <li><a href="#"><img style=" max-width: 100%;width: auto; height: 90px;" src="http://placehold.it/800x500"></a><h4>123123123 asdasd</h4></li> </ul> </li> </ul> </ul> <ul class="nav navbar-nav navbar-right"> <li><a href="#">Link</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="#">Action</a></li> <li><a href="#">Another action</a></li> <li><a href="#">Something else here</a></li> <li class="divider"></li> <li><a href="#">Separated link</a></li> </ul> </li> </ul> <form class="navbar-form" role="search"> <div class="input-group"> <input type="text" class="form-control pull-right" style="width: 300px; margin-right: 35px, border: 1px solid black; background-color: #e5e5e5;" placeholder="Search"> <span class="input-group-btn"> <button type="reset" class="btn btn-default"> <span class="glyphicon glyphicon-remove"> <span class="sr-only">Close</span> </span> </button> <button type="submit" class="btn btn-default"> <span class="glyphicon glyphicon-search"> <span class="sr-only">Search</span> </span> </button> </span> </div> </form> </div><!-- /.navbar-collapse --> </div><!-- /.container-fluid --> </nav> <div class="container"> <div class="row"> <div class="alert alert-info"> <strong>Alerts Dont Work on Bootsnipp!</strong> So when you hit enter or submit this form your result will show up in the green box below! </div> <div class="alert alert-success"> <strong>Your Result!</strong> <span id="showSearchTerm"></span> </div> </div> </div>
body { padding: 60px 0px; } .navbar-collapse { position: relative; padding-top: 30px !important; max-height: 270px; } .navbar-collapse form[role="search"] { position: absolute; top: 0px; right: 0px; width: 100%; padding: 0px; margin: 0px; z-index: 0; } .navbar-collapse form[role="search"] button, .navbar-collapse form[role="search"] input { padding: 8px 12px; border-radius: 0px; border-width: 0px; color: rgb(119, 119, 119); background-color: rgb(248, 248, 248); border-color: rgb(231, 231, 231); box-shadow: none; outline: none; } .navbar-collapse form[role="search"] input { padding: 16px 12px; font-size: 14pt; font-style: italic; color: rgb(160, 160, 160); box-shadow: none; } .navbar-collapse form[role="search"] button[type="reset"] { display: none; } @media (min-width: 768px) { .navbar-collapse { padding-top: 0px !important; padding-right: 38px !important; } .navbar-collapse form[role="search"] { width: 38px; } .navbar-collapse form[role="search"] button, .navbar-collapse form[role="search"] input { padding: 15px 12px; } .navbar-collapse form[role="search"] input { padding: 25px 12px; font-size: 18pt; opacity: 0; display: none; } .navbar-collapse form[role="search"].active { width: 100%; } .navbar-collapse form[role="search"].active button, .navbar-collapse form[role="search"].active input { display: table-cell; opacity: 1; } .navbar-collapse form[role="search"].active input { width: 100%; } } .dropdown-large { position: static !important; } .dropdown-menu-large { margin-left: 16px; margin-right: 16px; padding: 20px 0px; } .dropdown-menu-large > li > ul { padding: 0; margin: 0; } .dropdown-menu-large > li > ul > li, .dropdown-menu-large > li > ul > li > ul > li { list-style: none; } .dropdown-menu-large > li > ul > li > a, .dropdown-menu-large > li > ul > li > ul > li > a { display: block; padding: 3px 20px; clear: both; font-weight: normal; line-height: 1.428571429; color: #333333; white-space: normal; } .dropdown-menu-large > li ul > li > a:hover, .dropdown-menu-large > li ul > li > a:focus, .dropdown-menu-large > li ul > li > ul > li > a:hover, .dropdown-menu-large > li ul > li > ul > li > a:focus { text-decoration: none; color: #262626; background-color: #f5f5f5; } .dropdown-menu-large .disabled > a, .dropdown-menu-large .disabled > a:hover, .dropdown-menu-large .disabled > a:focus { color: #999999; } .dropdown-menu-large .disabled > a:hover, .dropdown-menu-large .disabled > a:focus { text-decoration: none; background-color: transparent; background-image: none; filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); cursor: not-allowed; } .dropdown-menu-large .dropdown-header { color: #428bca; font-size: 18px; } @media (max-width: 768px) { .dropdown-menu-large { margin-left: 0 ; margin-right: 0 ; } .dropdown-menu-large > li { margin-bottom: 30px; } .dropdown-menu-large > li:last-child { margin-bottom: 0; } .dropdown-menu-large .dropdown-header { padding: 3px 15px !important; } } .sticky { position: fixed !important; width: 100%; left: 0; top: 0; z-index: 9999; }
$(function () { // Remove Search if user Resets Form or hits Escape! $('body, .navbar-collapse form[role="search"] button[type="reset"]').on('click keyup', function(event) { console.log(event.currentTarget); if (event.which == 27 && $('.navbar-collapse form[role="search"]').hasClass('active') || $(event.currentTarget).attr('type') == 'reset') { closeSearch(); } }); function closeSearch() { var $form = $('.navbar-collapse form[role="search"].active') $form.find('input').val(''); $form.removeClass('active'); } // Show Search if form is not active // event.preventDefault() is important, this prevents the form from submitting $(document).on('click', '.navbar-collapse form[role="search"]:not(.active) button[type="submit"]', function(event) { event.preventDefault(); var $form = $(this).closest('form'), $input = $form.find('input'); $form.addClass('active'); $input.focus(); }); // ONLY FOR DEMO // Please use $('form').submit(function(event)) to track from submission // if your form is ajax remember to call `closeSearch()` to close the search container $(document).on('click', '.navbar-collapse form[role="search"].active button[type="submit"]', function(event) { event.preventDefault(); var $form = $(this).closest('form'), $input = $form.find('input'); $('#showSearchTerm').text($input.val()); closeSearch() }); }); jQuery(document).on('click', '.mega-dropdown', function(e) { e.stopPropagation() }) $("document").ready(function($){ var nav = $('.navbar-default'); $(window).scroll(function () { if ($(this).scrollTop() > 0) { nav.addClass("sticky"); } else { nav.removeClass("sticky"); } }); });

Related: See More


Questions / Comments: