"NIce Navbar bootstrap 4"
Bootstrap 4.1.1 Snippet by Shivamsemisetia

<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 ----------> <nav class="navbar navbar-expand-lg navbar-dark ftco_navbar bg-dark navbar-light" id="ftco-navbar"> <div class="container"> <a class="navbar-brand" href="index.html">logo</a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#ftco-nav" aria-controls="ftco-nav" aria-expanded="false" aria-label="Toggle navigation"> <span class="oi oi-menu"></span> Menu </button> <div class="collapse navbar-collapse" id="ftco-nav"> <ul class="navbar-nav ml-auto"> <li class="nav-item active"><a href="index.html" class="nav-link">Home</a></li> <li class="nav-item"><a href="about.html" class="nav-link">About</a></li> <li class="nav-item"><a href="project.html" class="nav-link">Project</a></li> <li class="nav-item"><a href="services.html" class="nav-link">Services</a></li> <li class="nav-item"><a href="blog.html" class="nav-link">Blog</a></li> <li class="nav-item"><a href="contact.html" class="nav-link">Contact</a></li> </ul> </div> </div> </nav>
body { background: #000; height: 10000px; } .navbar-light { background: transparent !important; position: absolute; top: 20px; left: 0; right: 0; z-index: 3; } @media (max-width: 991.98px) { .navbar-light { background: #000000 !important; position: relative; top: 0; } } .navbar-light .navbar-brand { color: #fff; } @media (min-width: 768px) { .navbar-light .navbar-brand { color: #fff; } } @media (min-width: 768px) { .navbar-light .navbar-brand.navbar-brand-black { color: #000000; } } .navbar-light .navbar-nav > .nav-item > .nav-link { font-size: 14px; padding-top: 0.9rem; padding-bottom: 0.9rem; padding-left: 20px; padding-right: 20px; color: #fff; font-weight: 400; opacity: 1 !important; } .navbar-light .navbar-nav > .nav-item > .nav-link:hover { color: #fff; } .navbar-light .navbar-nav > .nav-item .dropdown-menu { border: none; background: #fff; -moz-transition: all 0.3s ease; -o-transition: all 0.3s ease; -webkit-transition: all 0.3s ease; -ms-transition: all 0.3s ease; transition: all 0.3s ease; border-radius: 0; -webkit-box-shadow: 0px 10px 34px -20px rgba(0, 0, 0, 0.41); -moz-box-shadow: 0px 10px 34px -20px rgba(0, 0, 0, 0.41); box-shadow: 0px 10px 34px -20px rgba(0, 0, 0, 0.41); } .navbar-light .navbar-nav > .nav-item .dropdown-menu .dropdown-item { font-size: 13px; color: rgba(0, 0, 0, 0.7); } .navbar-light .navbar-nav > .nav-item .dropdown-menu .dropdown-item:hover, .navbar-light .navbar-nav > .nav-item .dropdown-menu .dropdown-item:focus { color: #000000; background: transparent; } .navbar-light .navbar-nav > .nav-item.ftco-seperator { position: relative; margin-left: 20px; padding-left: 20px; } @media (max-width: 991.98px) { .navbar-light .navbar-nav > .nav-item.ftco-seperator { padding-left: 0; margin-left: 0; } } .navbar-light .navbar-nav > .nav-item.ftco-seperator:before { position: absolute; content: ""; top: 10px; bottom: 10px; left: 0; width: 2px; background: rgba(255, 255, 255, 0.05); } @media (max-width: 991.98px) { .navbar-light .navbar-nav > .nav-item.ftco-seperator:before { display: none; } } .navbar-light .navbar-nav > .nav-item.cta > a { color: #fff; border: 1px solid rgba(255, 255, 255, 0.4); padding-top: 0.5rem; padding-bottom: 0.5rem; padding-left: 20px; padding-right: 20px; margin-top: 4px; -webkit-border-radius: 30px; -moz-border-radius: 30px; -ms-border-radius: 30px; border-radius: 30px; } .navbar-light .navbar-nav > .nav-item.cta > a span { display: inline-block; color: #fff; } .navbar-light .navbar-nav > .nav-item.cta > a:hover { background: #ffcdcd; border: 1px solid #ffcdcd; } .navbar-light .navbar-nav > .nav-item.cta.cta-colored span { border-color: #ffcdcd; } .navbar-light .navbar-nav > .nav-item.active > a { color: rgba(255, 255, 255, 0.5); } .navbar-light .navbar-toggler { border: none; color: rgba(255, 255, 255, 0.5) !important; cursor: pointer; padding-right: 0; text-transform: uppercase; font-size: 16px; letter-spacing: 0.1em; } .navbar-light.scrolled { position: fixed; right: 0; left: 0; top: 0; margin-top: -130px; background: #fff !important; -webkit-box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1); box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1); } .navbar-light.scrolled .nav-item.active > a { color: #ffcdcd !important; } .navbar-light.scrolled .nav-item.cta > a { color: #fff !important; background: #ffcdcd; border: none !important; padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; padding-left: 20px; padding-right: 20px; margin-top: 6px !important; -webkit-border-radius: 30px; -moz-border-radius: 30px; -ms-border-radius: 30px; border-radius: 30px; } .navbar-light.scrolled .nav-item.cta > a span { display: inline-block; color: #fff !important; } .navbar-light.scrolled .nav-item.cta.cta-colored span { border-color: #ffcdcd; } @media (max-width: 991.98px) { .navbar-light.scrolled .navbar-nav { background: none; border-radius: 0px; padding-left: 0rem !important; padding-right: 0rem !important; } } @media (max-width: 767.98px) { .navbar-light.scrolled .navbar-nav { background: none; padding-left: 0 !important; padding-right: 0 !important; } } .navbar-light.scrolled .navbar-toggler { border: none; color: rgba(0, 0, 0, 0.5) !important; border-color: rgba(0, 0, 0, 0.5) !important; cursor: pointer; padding-right: 0; text-transform: uppercase; font-size: 16px; letter-spacing: 0.1em; } .navbar-light.scrolled .nav-link { padding-top: 0.9rem !important; padding-bottom: 0.9rem !important; color: #000000 !important; } .navbar-light.scrolled .nav-link.active { color: #ffcdcd !important; } .navbar-light.scrolled.awake { margin-top: 0px; -webkit-transition: 0.3s all ease-out; -o-transition: 0.3s all ease-out; transition: 0.3s all ease-out; } .navbar-light.scrolled.sleep { -webkit-transition: 0.3s all ease-out; -o-transition: 0.3s all ease-out; transition: 0.3s all ease-out; } .navbar-light.scrolled .navbar-brand { color: #000000; } .navbar-brand { font-weight: 700; font-size: 20px; text-transform: uppercase; }
(function($) { // scroll var scrollWindow = function() { $(window).scroll(function(){ var $w = $(this), st = $w.scrollTop(), navbar = $('.ftco_navbar'), sd = $('.js-scroll-wrap'); if (st > 150) { if ( !navbar.hasClass('scrolled') ) { navbar.addClass('scrolled'); } } if (st < 150) { if ( navbar.hasClass('scrolled') ) { navbar.removeClass('scrolled sleep'); } } if ( st > 350 ) { if ( !navbar.hasClass('awake') ) { navbar.addClass('awake'); } if(sd.length > 0) { sd.addClass('sleep'); } } if ( st < 350 ) { if ( navbar.hasClass('awake') ) { navbar.removeClass('awake'); navbar.addClass('sleep'); } if(sd.length > 0) { sd.removeClass('sleep'); } } }); }; scrollWindow(); })(jQuery);

Related: See More


Questions / Comments: