cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

            
              <header>
  <nav>
    <span class="movetext">Company Name</span>
    <img class="" src="https://www.matchbook.com/assets/images/icons/white/Twitter_logo_white.png">
    <a href="#portion1" class="active">Portion1</a>
    <a href="#portion2">Portion2</a>
    <a href="#portion3">Portion3</a>
    <a href="#portion4">Portion4</a>
  </nav>
</header>

<div class="portion">
  <h2>Portion 1.</h2>
</div>

<div id="portion1" class="info">
  <h3>Heading for Portion 1</h3>
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Debitis nobis ut dicta quisquam officia deleniti, amet. Obcaecati atque, cumque quae culpa ad hic commodi provident pariatur, iure nobis voluptatibus laborum amet temporibus quia, dolores veritatis, repellendus consectetur. Ut ullam officiis minus quod assumenda facere quaerat, esse, magni, aliquid culpa vero.</p>
  <div class="button">
    <a href="#">Example Button</a>
  </div>
</div>

<div class="portion two">
  <h2>Portion 2</h2>
</div>

<div id="portion2" class="info">
  <h3>Heading for Portion 2</h3>
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Tempora pariatur voluptate laboriosam impedit praesentium sed, nihil, dignissimos et minima recusandae quaerat enim consectetur. Molestiae assumenda distinctio, rem nostrum dolores repellendus.</p>
  <div class="button">
    <a href="#">Example Button</a>
  </div>
</div>

<div class="portion">
  <h2>Portion 3.</h2>
</div>

<div id="portion3" class="info">
  <h3>Heading for Portion 3.</h3>
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Odio accusamus in vitae saepe harum soluta reiciendis eaque repellat distinctio quos voluptate nemo error ratione numquam, nisi quibusdam veritatis repudiandae ea possimus rerum pariatur dolores? Optio inventore iusto, voluptatibus numquam aperiam, harum maxime beatae minima aliquam quas sapiente totam cumque unde..</p>
  <div class="button">
    <a href="#">Example Button</a>
  </div>
</div>

<div class="portion two">
  <h2>Portion 4.</h2>
</div>

<div id="portion4" class="info">
  <h3>Heading for Portion 4.</h3>
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Magni incidunt quos iste voluptates, tenetur ad repudiandae ea fuga eveniet quam, unde iure suscipit rem odit in, sint nulla itaque? Labore beatae, est voluptatibus saepe rerum illum repudiandae quasi perspiciatis, molestiae quidem fugiat voluptates voluptate neque totam earum enim mollitia iure quod tempora veritatis quam optio. Error odit laudantium eum voluptate.</p>
  <div class="button">
    <a href="#">Example Button</a>
  </div>
</div>
<footer class="info">
  <div id="toTop"><a href="#"><img src="http://www.superdruglookatme.com/wp-content/themes/superdrug/images/top.png"></a></div>
  <p>&copy; 2014 Arif Hussain Bangash</p>
  
</footer>
            
          
!
            
              body {
  margin: 0;
  padding: 0;
  font-family: "Source Sans Pro", sans-serif;
  font-size: 20px;
}

header nav {
  text-align: right;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 1em;
  position: fixed;
  width: 100%;
}
header nav a {
  color: inherit;
  text-decoration: none;
  display: inline-block;
  padding: 2em 1em .5em;
  -webkit-transition: all .3s ease-in;
}
.small {
  padding: .5em 1em;
}
header nav a:hover {
  text-decoration: underline;
}

.active {
  background: rgba(255,255,255,0.3);
}

.portion {
  
  background-image:  url('http://p1.pichost.me/640/60/1842352.jpg');
  background-position: center center;
  background-attachment: fixed;
  background-size: cover;
  text-align: center;
}
.portion.two {
  background-image: url('http://cdn.desktopwallpapers4.me/media/thumbs_400x250/4/31677.jpg');
}
.portion h2 {
  color: white;
  font-weight: normal;
  font-size: 3em;
  padding: 2em 0;
  margin: 0;
  text-shadow: 0 0 10px black;
  background: rgba(0,0,0,0.6);
}

.info {
  background: #FFFAF0;
  color: #777;
  padding: 3em 20%;
}

.button {
  text-align: center;
}
.button a {
  display: inline-block;
  border: 2px solid #777;
  padding: .75em 1.5em;
  color: #777;
  text-decoration: none;
  text-transform: uppercase;
  border-radius: 5px;
  letter-spacing: .15em;
  word-spacing: .25em;
  font-weight: bold;
  transition: all 0.3s ease-in-out;
}
.button a:hover {
  color: #FFFAF0;
  background: #777;
}
footer.info {
  color: #FFFAF0;
  background: #777;
  padding: 0 auto;
  text-align: center;
}

#toTop img {
  width: 50px;
}
#toTop img:hover {
  cursor: pointer;
}
nav img {
  z-index: 1000;
  height: 2.5em;
  position: absolute;
  left: 40px;
  top: 10px;
  transition: all 0.5s linear;
}

.move {
  top: -60px;
}

nav span {
  position: absolute;
  left: 40px;
  top: 10px;
  font-weight: bold;
  transition: all 0.5s ease-in;
}

.movetext {
  top: -30px;
}
            
          
!
            
              // Smooth Scroll on clicking nav items
$('nav a').click(function () {
  var $href = $(this).attr('href');
  $('body').stop().animate({
    scrollTop: $($href).offset().top
  }, 1000);
  return false;
});

// back to top
$('#toTop a').click(function () {
  $('body').animate({
    scrollTop: 0
  }, 1000);
  return false;
});

// Parallaxing + add class active on scroll
$(document).scroll(function () {
  
  // parallaxing
  var $movebg = $(window).scrollTop() * -0.3;
  $('.portion').css('background-positionY', ($movebg) + 'px');

  // add class active to nav a on scroll
  var scrollPos = $(document).scrollTop() + 100;
  $('nav a').each(function () {
    var currLink = $(this);
    var refElement = $(currLink.attr("href"));
    if (refElement.position().top <= scrollPos && refElement.position().top + refElement.height() > scrollPos) {
      $('nav a').removeClass("active");
      currLink.addClass("active");
    }
  });
  
  // changing padding of nav a on scroll
    if (scrollPos > 250) {
      $('nav a').addClass('small');
      $('nav img').addClass('move');
      $('nav span').removeClass('movetext');
    } else {
      $('nav a').removeClass('small');
      $('nav img').removeClass('move');
      $('nav span').addClass('movetext');
    }
  
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console