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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <header>
  <div id="menu">
    <ul>
      <li><a class="button" href="#home">Home</a></li>
      <li><a class="button" href="#about">About</a></li>
      <li><a class="button" href="#services">Services</a></li>
      <li><a class="button" href="#projects">Projects</a></li>
      <li><a class="button" href="#contact">Contact</a></li>
    </ul>
  </div>
</header>

<section id="home"></section>

<section id="about">
  <p>About</p>
  <p class="fading">The path of the righteous man is beset on all sides by the iniquities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother’s keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy My brothers. And you will know My name is the Lord when I lay My vengeance upon thee.</p>
</section>
<section id="services">
  <p>Services</p>
  <p class="fading">The path of the righteous man is beset on all sides by the iniquities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother’s keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy My brothers. And you will know My name is the Lord when I lay My vengeance upon thee.</p>
</section>
<section id="projects">
  <p>Projects</p>
  <p class="fading">The path of the righteous man is beset on all sides by the iniquities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother’s keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy My brothers. And you will know My name is the Lord when I lay My vengeance upon thee.</p>
</section>
<section id="contact">
  <p>Contact</p>
  <p class="fading">The path of the righteous man is beset on all sides by the iniquities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother’s keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy My brothers. And you will know My name is the Lord when I lay My vengeance upon thee.</p>
</section>
              
            
!

CSS

              
                * {
  margin: 0;
}

body, a {
  color: seashell;
}

header, section {
  text-align: center;  
}

#menu {
  width: 100%;
  position: fixed;
  text-decoration: none;
  background: rgba(40,40,40,0.7);
  padding: 20px 0;
  z-index: 1;
}

#menu a {
  font-family: helvetica, arial;
  font-size: 17px;
  font-weight: bold;
  text-decoration: none;
  text-shadow: 0 0 4px black;
}

#menu li {
  display: inline-block;
  list-style-type: none;
  margin: 0 15px;
}

section {
  height: 100vh;
  position: relative;
  background: grey;
  border-top: 1px solid #4c4c4c;
  box-sizing: border-box;
}

section p:first-child {
  font-family: helvetica, arial;
  font-size: 23px;
  line-height: 30px;
  text-shadow: 0 0 5px black;
  padding: 10px 0 25px;
  margin-top: 70px;
}

.fading {
  margin: 0 50px;
  opacity: 0;
}

#home {
  background: url(http://ataredo.com/external/image/yosemite.jpg) center / cover;
}
              
            
!

JS

              
                $(function() {

	var modern = window.requestAnimationFrame,
	target = $('.fading'), zenith, nadir, spot, pilot;

	storeDimensions();

	$(window).resize(storeDimensions).scroll(function() {

		spot = $(this).scrollTop();

		if (!pilot) {
		if (modern) requestAnimationFrame(checkFade);
		else checkFade();
		}
	});

	$('.button').click(function(e) {

		e.preventDefault();

		pilot = true;

		var destination = $(this.hash).offset().top,
		goal = $(this.hash).find('.fading');

		if (destination != spot && goal.length) goal.stop().fadeTo(0,0);

		$('html, body').animate({scrollTop: destination}, 600, function() {

			if (goal.length) goal.fadeTo(1500,1);
			pilot = false;
		});
	});

function storeDimensions() {

	zenith = []; nadir = [];

	target.each(function() {

		var placement = $(this).offset().top;

		zenith.push(placement-$(window).height()*0.8);
		nadir.push(placement+$(this).outerHeight());
	});
}

function checkFade() {

	target.each(function(i) {

		if (!$(this).is(':animated')) {
		if (spot > zenith[i] && spot < nadir[i]) $(this).fadeTo(1500,1);
		else if ($(this).css('opacity') != 0) $(this).fadeTo(0,0);
		}
	});
}
});
              
            
!
999px

Console