Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

Save Automatically?

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 data-spy="scroll" data-target=".scrollspy">
  <div class="jumbotron">
    <div class="container">
      <h1>Playing with Bootstrap</h1>
      <h3><span class="fa fa-pencil"></span> Affix & Scrollspy plugins help you create nice scrolling effects.</h3>
      <h3><span class="fa fa-pencil"></span> Minimal code is needed. Plugins take care of the rest.</h3>
      <h3><span class="fa fa-pencil"></span> This demo will help you understand how to use them in your projects.</h3>
      <a href="http://www.sitepoint.com/understanding-bootstraps-affix-scrollspy-plugins" class="btn btn-primary btn-lg">Learn More</a>
    </div>
  </div><!--end of .jumbotron-->

  <div class="container">
    <div class="row">

      <div class="col-md-3 scrollspy">
        <ul id="nav" class="nav hidden-xs hidden-sm" data-spy="affix">
          <li><a href="#web-design">Web Design</a></li>
   <li><a href="#web-design">Web Design</a></li>
             <li><a href="#web-design">Web Design</a></li>
             <li><a href="#web-design">Web Design</a></li>
             <li><a href="#web-design">Web Design</a></li>
             <li><a href="#web-design">Web Design</a></li>
             <li><a href="#web-design">Web Design</a></li>
             <li><a href="#web-design">Web Design</a></li>
             <li><a href="#web-design">Web Design</a></li>
             <li><a href="#web-design">Web Design</a></li>
           <li><a href="#web-design">Web Design</a></li>
           <li><a href="#web-design">Web Design</a></li>
           <li><a href="#web-design">Web Design</a></li>
           <li><a href="#web-design">Web Design</a></li>
           <li><a href="#web-design">Web Design</a></li>
           <li><a href="#web-design">Web Design</a></li>
           <li><a href="#web-design">Web Design</a></li> <li><a href="#web-design">Web Design</a></li>
          <li><a href="#marketing">Marketing</a></li>
          <li><a href="#graphic-design">Graphic Design</a></li>
          <li><a href="#logistics">Logistics</a></li>
        


        </ul>
      </div>

      <div class="col-md-9">
        <section id="web-design">
          <h2><span class="fa fa-edit"></span> Web Design</h2>
          <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean
adipiscing elit. Aenean commodo ligula eget dolor. Aenean
          </p>


          <button type="button" class="btn btn-primary">Learn More</button>
        </section><!--end of #web-design-->





      
      </div>
    
    </div><!--end of .row-->
  </div><!--end of .container-->
  
  <section class="application">
    <div class="container">
      <h2>Come and Join Us</h2>
      <div class="row">
        <div class="col-sm-6">
          <p>Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus.
          Nullam quis ante.
          </p>
          <img class="img-responsive  " src="http://placehold.it/500x250/5fb3ce/000000">
        </div>
        <div class="col-sm-6">
          <p>Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante.
          Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh.
          Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem.
          </p>
          <p>Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante.
          Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh.
          Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem.
          </p>
          <p>Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante.
          Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh.
          Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem.
          </p>
          <button type="button" class="btn btn-primary">Apply Now</button>
        </div>
      </div><!--end of .row-->
    </div><!--end of .container-->
  </section>
  
  <footer>
    <p class="text-center">A demo by George Martsoukos. <a href="http://www.sitepoint.com/understanding-bootstraps-affix-scrollspy-plugins">See article.</a></p>
  </footer> 
</body>
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Raleway:400,700);
#div1{
  display: none;
}
body {
  background: lightblue;
  position: relative;
  line-height: 1.5;
  font-family: 'Raleway', sans-serif;
}

h1, h2 {
  font-weight: 700;
}

h3 span {
  color: #286090;
}

.jumbotron {
  border-radius: 0px;
  background: #5fb3ce;
  margin-bottom: 0;
}

.jumbotron button {
  margin-top: 10px;
}

section {
  padding: 40px 0;
  border-bottom: 1px solid #c1e1ec;
}

#web-development,
#mobile-development {
  padding-bottom: 0;
}

section:last-child {
  border-bottom: none;
}

.nav {
  background: #4baac8;
}

.nav a {
  color: black;
  font-style: italic;
}

.nav li a:hover,
.nav li a:focus {
  background: #86c5da;
}

.nav .active {
  font-weight: bold;
  background: #72bcd4;
}

.nav .nav {
  display: none;
}

.nav .active .nav {
  display: block;
}

.nav .nav a {
  font-weight: normal;
  font-size: .85em;
}

.nav .nav span {
  margin: 0 5px 0 2px;
}

.nav .nav .active a,
.nav .nav .active:hover a,
.nav .nav .active:focus a {
  font-weight: bold;
  padding-left: 30px;
  border-left: 5px solid black;
}

.nav .nav .active span,
.nav .nav .active:hover span,
.nav .nav .active:focus span {
  display: none;
}

.application {
  border-top: 1px solid #c1e1ec;
}

.affix-top {
  position: relative;
}

.affix {
  top: 20px;
}

.affix, 
.affix-bottom {
    width: 213px;
}

.affix-bottom {
  position: absolute;
}

footer {
  border-top: 1px solid #c1e1ec;
  height: 50px;
}

footer p {
  line-height: 50px;
  margin-bottom: 0;
}

@media (min-width:1200px) {
  .affix, 
  .affix-bottom {
    width: 263px;
  }
}
              
            
!

JS

              
                $('#nav').affix({
    offset: {     
      top: $('#nav').offset().top,
      bottom: ($('footer').outerHeight(true) + $('.application').outerHeight(true)) + 40
    }
});

function viewDiv(){
  document.getElementById("div1").style.display = "block";
};
              
            
!
999px

Console