Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <body>
<nav class="navbar navbar-default navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <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="#">Transparent to Solid Nav</a>
        </div>
        <div id="navbar" class="collapse navbar-collapse">
          <ul class="nav navbar-nav navbar-right">
            <li><a href="#">About</a></li>
            <li><a href="#">Link</a></li>
            <li><a href="#">Another Link</a></li>
          </ul>
        </div><!--/.nav-collapse -->
      </div>
    </nav>

<div class="image">
   <h1 class="heading">Main Heading</h1>
   <p><button class="btn btn-large">Big Button</button></p>
</div>
<div class="about">
   <h2>Main Description</h2>
   <p>Roll on the floor purring your whiskers off intrigued by the shower burrow under covers, and play time, rub face on everything, intently sniff hand, or pelt around the house and up and down stairs chasing phantoms. Attack feet. Damn that dog shake treat bag under the bed drink water out of the faucet for lick butt love to play with owner's hair tie. Swat at dog give attitude.</p>
</div>
   
</body>
              
            
!

CSS

              
                .image {
   background-color: #490D40;
   background: url(https://sonorangirl.github.io/Earth-Quotes/img/google-earth-view-South-Iceland3.jpg) no-repeat center center;
   background-size: cover;
   height: 570px;
   margin-top: -20px;
   
   .heading {
      color: white;
      text-align: center;
      padding-top: 200px;
   }

   p {
      text-align: center;
      padding: 20px 60px;
      
       .btn {
         background-color: transparent;
         color: white;
         border: 1px solid white;
         padding: 10px;
         font-size: 1.2em;
             
          &:hover {
             color: #C57ED3;
             border-color: #C57ED3;
          }
      }
   }
}

.navbar {
  height: 80px;
  background-color: transparent;
  border: none;
  color: white;
  z-index: 100;
  transition: background-color 1s ease 0s;
}


.navbar-default {
  
   .navbar-brand {
     margin-top: 10px;
     color: white;
        
      &:hover {
         color: #C57ED3;
         border: 1px solid #C57ED3;
      } 
   }
   
  .navbar-nav {
    
    > li {
      
      > a {
        color: white;
        margin: 10px 5px 5px 5px;
        
      }
      > a:hover, > a:active, > a:focus {
        color: #C57ED3;
        border: 1px solid #C57ED3;
      }
      > a:visited {
        color: #C57ED3;
        text-decoration: none;
      }

    } //end li

    > .active {

      > a, > a:hover, > a:focus {
        background-color: transparent;
        color: #C57ED3;
      }

    }

  } //end .navbar-nav

  //Collapsed styles
  .navbar-toggle {
    border-color: #C57ED3;

      &:hover, &:focus {
        background-color: #490D40;
      }



      .icon-bar {
        color: #C57ED3;
        background-color: #C57ED3;

      }
  }

  .navbar-collapse.collapse.in ul {
    background-color: #490D40;
  }
    
} //end .navbar-default



/* Solid class attached on scroll past first section */

.navbar.solid {
  background-color: #490D40;
  transition: background-color 1s ease 0s;
  box-shadow: 0 0 4px grey;

    .navbar-brand {
      color: #C57ED3;
      transition: color 1s ease 0s;
    }

    .navbar-nav {

       > li {

          > a {
            color: #C57ED3;
            transition: color 1s ease 0s;
          }

       } //end li

    } //end .navbar-nav

}

.about {
   background-color: #C57ED3;
   color: #490D40;
   height: 600px;
   text-align: center;
   margin-top: -20px;
   
   h2 {
      padding-top: 220px;
   }
   p {
      padding: 20px 80px;
   }
}


              
            
!

JS

              
                $(document).ready(function() {
        // Transition effect for navbar 
        $(window).scroll(function() {
          // checks if window is scrolled more than 500px, adds/removes solid class
          if($(this).scrollTop() > 500) { 
              $('.navbar').addClass('solid');
          } else {
              $('.navbar').removeClass('solid');
          }
        });
});
              
            
!
999px

Console