"Header change on scroll"
Bootstrap 4.1.1 Snippet by imsachin

<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="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/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 ----------> <!DOCTYPE html> <html lang="en"> <head> <title>HTML</title> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="https://fonts.googleapis.com/css?family=Roboto:400,500,700" rel="stylesheet"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <!--[if IE]> <link href="~/Content/NewHomePage/all-ie-only.css" rel="stylesheet" /> <![endif]--> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <link rel="stylesheet" href="style.css"> </head> <body> <!--header-start--> <div class="header" id="navbar"> <div class="container"> <div class="logo"> <a href="index1.html"><img src="images/logo-invert.png"/></a> </div> <div class="navigation"> <ul> <li class="nav-home"><a href="">Home</a></li> <li class="nav-about"><a href="">About</a></li> <li><a href="">Services</a></li> <li><a href="">Contact</a></li> </ul> </div> </div> </div> <!--welcome to travel--> <div class="welcome-to-travel wthree_head_section"> <div class="container"> <div class="row"> <div class="col-sm-12 "> <h1 class="w3l_header">Welcome To <span>Travel</span></h1> <p >You’ll always have fascinating places to be and friendly people to see.</p> </div> <div class="col-md-5 about-grid1"> </div> <div class="col-md-7 about-grid2"> <div class="about-subgrid"> <p>We Provide Best Guidence</p> <h2>Travel</h2> <span>Tours and Travels</span> <h5>we are specialised at-</h5> <ul class="w3l-about-list"> <li>Switzerland Tour</li> <li>Beach Tour</li> <li>Thailand Tour</li> <li>Historical Tour</li> <li>Adventure Tour</li> </ul> </div> </div> </div> </div> </div> <!--banner-fixed find travel perfection--> <div class="middle-w3l"> <div class="container"> <div class="middle-left-w3l"> <h4>Find Travel Perfection With the Professionalism of Experts</h4> <p>Go, fly, roam, travel, voyage, explore, journey, discover, adventure.</p> <div class="readmore-w3-agileits about-read"> <a href="contact.html">Contact Us</a> </div> </div> </div> </div> <!--our services--> <div class="wthree_services" id="services"> <div class="container"> <h3 class="title">Our Services</h3> <div class="col-md-4 wthree_services_left"> <div class="col-xs-4 wthree_services_left_grid"> <div class="wthree_services_left_grid1"> <i class="fa fa-plane" aria-hidden="true"></i> </div> </div> <div class="col-xs-8 wthree_services_left_grid_left"> <h3>Travel Arrangements</h3> <p>Lorem ipsum dolor sit amet, consectetur adipiscing iscing elit</p> </div> <div class="clearfix"></div> </div> <div class="col-md-4 wthree_services_left"> <div class="col-xs-4 wthree_services_left_grid"> <div class="wthree_services_left_grid1"> <i class="fa fa-globe" aria-hidden="true"></i> </div> </div> <div class="col-xs-8 wthree_services_left_grid_left"> <h3>Special Activities</h3> <p>Lorem ipsum dolor sit amet, consectetur adipiscing iscing elit</p> </div> <div class="clearfix"></div> </div> <div class="col-md-4 wthree_services_left"> <div class="col-xs-4 wthree_services_left_grid"> <div class="wthree_services_left_grid1"> <i class="fa fa-suitcase" aria-hidden="true"></i> </div> </div> <div class="col-xs-8 wthree_services_left_grid_left"> <h3>Beautiful Places</h3> <p>Lorem ipsum dolor sit amet, consectetur adipiscing iscing elit</p> </div> <div class="clearfix"></div> </div> </div> </div> <!--second-footer--> <div class="footer"> <div class="container"> <div class="footer-row w3layouts-agile"> <div class="col-md-4 col-xs-4 footer-grids"> <h2>More Information</h2> <p class="footer-one-w3ls">This is a great you can use this space to go into a little more detail about your company. Talk about your team and what services you provide. </p> </div> <div class="col-md-5 col-xs-5 footer-grids w3l-agileits"> <h3>Newsletter</h3> <p>Recieve our latest news straight to your inbox</p> <form action="#" method="post"> <input type="email" placeholder="Email" name="email" required> <input type="submit" value="Subscribe"> </form> </div> <div class="col-md-3 col-xs-3 footer-grids social-agileits"> <h3>Connect With Us</h3> <div class="social-w3l"> <ul> <li><a href="" class="wthree_facebook"> <i class="fa fa-facebook" aria-hidden="true"></i></a></li> <li><a href="" class="wthree_twitter"> <i class="fa fa-twitter" aria-hidden="true"></i></a></li> <li><a href="" class="wthree_dribbble"> <i class="fa fa-dribbble" aria-hidden="true"></i></a></li> </ul> </div> <div class="social-w3r"> <ul> <li><a href="">Facebook</a></li> <li><a href="">Twitter</a></li> <li><a href="">Dribbble</a></li> </ul> </div> </div> <div class="clearfix"></div> </div> </div> </div> <div class="copy-section"> <p>© 2018 Desing . All rights reserved | Design by <a href="">Design</a></p> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <script src="custom.js"></script> </body> </html>
.header/*{padding:10px 0px;background:#282e3c;}*/{ padding: 10px 16px;background:#143ca1;color:#000;font-weight:400;font-size:16px;}/*position: fixed;z-index: 9;width: 100%;top: 0;}postion fixed without stricy postion:fixed start*/ /* The sticky class is added to the navbar with JS when it reaches its scroll position */ .darkHeader{ height: auto; background-color:#000 ; position: fixed; top:0; width: 100%; z-index:99; } .darkHeader a{color:#2ec4b6 !important;} /*stricy content end*/ ul {margin: 0;padding: 0;} .content {padding: 16px;} .container{width:1170px;margin:0 auto;} .sticky {position: fixed;top: 0;width: 100%} .sticky + .content{padding-top: 102px;} .logo{width:20%;float:left;} .navigation{float:right;} .navigation ul li{list-style:none;display:inline-block;margin-right:20px;margin-top:10px;} .navigation ul li a{color:#fff;} .navigation ul li a:hover{text-decoration:none;} .nav-home:after{border-top: 2px solid #9f4f5c;display: block;width:45px;content: "";margin: 8px auto 0;} /*welcome to Travel*/ .w3l_header {font-size: 3em;color: #262c38;letter-spacing: 1px;position: relative;font-weight: 600;text-align: center;} .welcome-to-travel{margin-bottom:50px;} .wthree_head_section p {font-size: 15px;text-align: center;margin: 20px auto;width: 60%;color: #5e5e5e;line-height: 1.8em;} .w3l_header:after {border-top: 2px solid #9f4f5c;display: block;width: 81px;content: "";margin: 8px auto 0;} .about-grid1 {background: url(https://bestjquery.com/tutorial/product-grid/demo9/images/img-2.jpg) no-repeat center;background-size: cover;min-height: 450px;border: 1px solid #d6d6d6;} .about-grid2 {padding: 0em 0 0 4em;} .about-subgrid p {color: #000;text-transform:capitalize;font-size: 1.8em;font-weight: bold;font-style: italic;margin: 0;} .about-subgrid h2 {font-size: 2.2em;text-transform: uppercase;color: #000;margin: 0.5em 0;display: inline-block;border-right: 5px double #9f4f5c;padding-right: 10px;} .about-subgrid span {color: #000;font-weight: 800;font-size: 1em;padding-left: 27px;letter-spacing: 1px;text-transform: uppercase;} .about-subgrid h5 {color: #000;font-size: 1.5em;text-transform: capitalize;margin: 1em 0;border: 2px solid #9f4f5c;display: inline-block;padding: 5px 10px;width: 50%;} ul.w3l-about-list {padding: 0em 0 0 2em;} ul.w3l-about-list li {list-style-type: square;font-size: 1.2em;color: #000;line-height: 2;letter-spacing: 0.5px;font-style: italic;font-weight: 600;} /*banner- fixed travel perfection--css-image-style*/ .middle-w3l {background: url(http://lorempixel.com/1920/1920/city/9/) no-repeat fixed;background-size: cover;padding: 10em 0 8em;} .middle-left-w3l {text-align: right;width: 70%;float: right;} .middle-left-w3l h4 {color: #fff;font-size: 40px;line-height: 1.4;} .middle-left-w3l p {color: #fff;margin: 10px 0 20px;} .readmore-w3-agileits.about-read a {background: #9f4f5c;margin-top: 30px;border-radius: 4px;} .readmore-w3-agileits a {border: 1px solid #fff;display: inline-block;text-decoration: none;color: #fff;font-size: 15px;letter-spacing: 1px;padding: 12px 30px;-webkit-transition: 0.5s all;transition: 0.5s all;} /*our services*/ .wthree_services {background: #2ec4b6;padding: 5em 0;margin-bottom:50px;} h3.title {color: #272525;font-size: 45px;text-align: center;font-style: italic;margin-bottom: 50px;position: relative;} h3.title:before {content: "";background: #9f4f5c;position: absolute;width: 110px;height: 2px;bottom: -25%;left: 45%;} .wthree_services_left_grid1 {width: 65px;height: 65px;background: #9f4f5c;text-align: center;margin: 0 auto;} .wthree_services_left_grid1 i {font-size: 28px;color: #fff;line-height: 2.3;} .wthree_services_left_grid_left {padding: 0;} .wthree_services_left_grid_left h3 {font-size: 24px;color: #fff;letter-spacing: 1px;margin: 0;padding: 0;font-family: 'Amaranth', sans-serif;} /*2nd footer*/ .footer {padding: 4em 0;background-color: #151414;} .footer h3, .footer h2 {color: #fff;font-size: 25px;margin-bottom: 16px;letter-spacing: 1px;} p.footer-one-w3ls {font-size: 14px;} .footer h3 {color: #fff;font-size: 25px;margin-bottom: 16px;letter-spacing: 1px;} p {margin: 0;padding: 0;font-family: 'Open Sans', sans-serif;font-size: 15px;letter-spacing: 1px;line-height: 1.9;color: #999;} .footer-grids form {margin-top: 30px;} .footer-grids form input[type="email"] {width: 100%;padding: 12px;font-size: 15px;color: #000;outline: none;border: none;background: #fff;letter-spacing: 1px;} .footer-grids form input[type="submit"] {width: 46%;font-size: 16px;color: #fff;display: inherit;text-align: center;margin: 0 auto;outline: none;padding: 12px;border: none;letter-spacing: 1px;background: #9f4f5c;-webkit-transition: 0.5s all;margin-top: 20px;} .social-w3l {text-align: left;float: left;width: 26%;} .social-w3l ul li {display: block;font-weight: 600;margin: 1.5em 0em 1.8em;text-align: center;} .social-w3l ul li a {display: block;color: #fff;text-decoration: none;width: 35px;height: 35px;padding: 4px 0 0 0px;background: #2ec4b6;transform: rotate(45deg);line-height: 2em;} .social-w3r ul li {display: block;} .social-w3r ul li a {color: #fff;letter-spacing: 1px;margin: 22px 0;display: inline-block;} .social-w3l ul li a i {transform: rotate(-45deg);font-size: 16px;line-height:30px;} .copy-section {padding: 1.5em 0;background: #000;text-align: center;} .copy-section p {font-size: 15px;color: #fff;letter-spacing: 2px;} .copy-section a {color: #9f4f5c;}
$( function() { $( ".depart_date" ).datepicker({ numberOfMonths: 2, minDate: 0 }); $( ".return_date" ).datepicker({ numberOfMonths: 2, minDate: 0 }); }); $(window).scroll(function() { var scroll = $(window).scrollTop(); if (scroll >= 2) { $(".header").addClass("darkHeader"); } else { $(".header").removeClass("darkHeader"); } });

Related: See More


Questions / Comments: