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 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

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>
    <nav class="navbar">
    <div class="progress-bar"></div>
    <div class="progress-bar--increment"></div>
      <ul>
          <li><a href="#top">Header</a></li>
          <li><a href="#article-1"><span class="progress-bar--circle"></span>Article 1</a></li>
          <li><a href="#article-2"><span class="progress-bar--circle"></span>Article 2</a></li>
          <li><a href="#article-3"><span class="progress-bar--circle"></span>Article 3</a></li>
      </ul>
    </nav>

    <header id="top">
      <h1>Welcome to the top!</h1>
    </header>

    <main>
      <article class="article" id="article-1">
        <h2>Article 1</h2>
      </article>

      <article class="article" id="article-2">
        <h2>Article 2</h2>
      </article>

      <article class="article" id="article-3">
        <h2>Article 3</h2>
      </article>
    </main>

    <footer id="bottom">
      <h3>Welcome to the bottom!</h3>
    </footer>
  </body>
              
            
!

CSS

              
                /* Global */
@import url('https://fonts.googleapis.com/css?family=Roboto');

* {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Roboto', sans-serif;
  font-size: 16px;
  background-color: #2C3E50;
  color: white;
}

/* Navbar - Progress Bar */
.navbar {
  position: fixed;
  top: 5em;
  left: 3em;
  height: 175px;
  z-index: 1;
}

.progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    border-radius: 5px;
    background-color: rgba(255, 255, 255, 0.5);
}

.progress-bar--increment {
  background-color: #E74C5B;
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 0;
  border-radius: 5px;
}

.progress-bar--circle {
  position: absolute;
  bottom: 5px;
  left: -21px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.8);
  transition: all 0.1s;
}

.progress-bar--circle.active {
  background-color: #E74C5B;
}

.navbar ul {
    padding: 0 1em;
    list-style: none;
}

.navbar ul li {
    position: relative;
    margin-bottom: 1em;
}

.navbar ul li a {
    font-size: 1.2em;
    color: white;
    text-decoration: none;
    transition: all 0.1s;
}

.active {
 color: #E74C5B !important;
}

/* Main */
header {
  width: 100%;
  height: 500px;
}

header h1, article h2, footer h3{
    position: relative;
    top: 50%;
    font-size: 4em;
    text-align: center;
}

article {
    border: 1px solid white;
    width: 100%;
    height: 500px;
}

footer {
    height: 500px;
    width: 100%;
}

              
            
!

JS

              
                $(document).ready(function(){

  // Anchor arrow click
  // smooth scroll to anchor tag
 $('a[href*="#"]:not([href="#featured"])').click(function() { // Check to see if anchor tag is not carousel's featured link
      if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
        var target = $(this.hash);
        target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
        if (target.length) {
          // Smooth scroll to link section
          $('html, body').animate({
            scrollTop: target.offset().top + 50
          }, 900);
          return false;
        }
      }
    });
    
  //highlight navigation
  $(window).scroll(function() {
    var windowpos = $(window).scrollTop();
    $('nav li a').removeClass('active');
    $('.progress-bar--circle').removeClass('active');

    if (windowpos > $('#top').offset().top) {
      $('nav li a').removeClass('active');
      $('a[href$="#top"]').addClass('active');
    } //windowpos

    if (windowpos > $('#article-1').offset().top) {
      $('nav li a').removeClass('active');
      $('a[href$="#article-1"]').addClass('active');
      $('a[href$="#article-1"] .progress-bar--circle').addClass('active');
    } //windowpos

    if (windowpos > $('#article-2').offset().top) {
      $('nav li a').removeClass('active');
      $('a[href$="#article-2"]').addClass('active');
      $('a[href$="#article-2"] .progress-bar--circle').addClass('active');
    } //windowpos

    if (windowpos > $('#article-3').offset().top) {
      $('nav li a').removeClass('active');
      $('a[href$="#article-3"]').addClass('active');
      $('a[href$="#article-3"] .progress-bar--circle').addClass('active');
    } //windowpos

    if (windowpos > $('#bottom').offset().top) {
      $('nav li a').removeClass('active');
      $('a[href$="#bottom"]').addClass('active');
    } //windowpos

    // Scrollbar progression
        // pixels scrolled from top
    var scrollTop = $(window).scrollTop(),
        // document height
        docHeight = $(document).height(),
        // window height
        winHeight = $(window).height(),
        // percent of document scrolled
        scrollPercent = (scrollTop) / (docHeight - winHeight),
        scrollPercentRounded = Math.round(scrollPercent*100);

    // incement progress bar as user scrolls
    $('.progress-bar--increment').css('height', scrollPercentRounded + '%');
  });

}); // on load

              
            
!
999px

Console