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

              
                <section class="under">
	<div class="under-inner one">
		<h1 class="fixed">The Issue:</h1>
	</div>
</section>
<section class="over">
	<div class="over-inner centered">
		<p>I needed to have each section start with a different background image, but the section title needed to be fixed position while the content scrolled over both. This wasnt difficult but the tricky part was having mulitple occurrences of pattern. The "fixed" titles would overlap and be in the incorrect sections.</p>
	</div>
</section>
<section class="under">
	<div class="under-inner two">
		<h2 class="fixed">The Solution:</h2>
	</div>
</section>
<section class="over">
	<div class="over-inner centered">
		<p>Using Waypoints I am hiding and showing section titles as you scroll past the titles. When the title is underneath the section, the title is moved off the screen.</p>
	</div>
</section>
<section class="under">
	<div class="under-inner three">
		<h3 class="fixed">The End.</h3>
	</div>
</section>


              
            
!

CSS

              
                *{
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}
html {
  font-size: 100%;
  color: #ddd;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased !important;
  text-rendering: optimizelegibility;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3{
	font-family: 'Oswald', sans-serif;
	font-size: 64px;
	line-height: 1.328125;
	font-weight: 900;
}
body{
	font-family: Georgia, serif;
	font-size: 21px;
	line-height: 1.57142857;
}
section{
	height: 100vh;
	width: 100%;
	background: #222;
	background-position: center;
	&.over{
		position: relative;
		z-index: 10;
	}
	.over-inner{
		position: relative;
	}
	.under-inner{
		color: white;
		height: 100vh;
		position: relative;
		background-repeat: no-repeat;
		background-attachment: fixed;
		background-position: center;
		background-size: cover;
	}
	.one{
		background-image: url(https://unsplash.it/1200/750?image=999);
	}
	.two{
		background-image: url(https://unsplash.it/1200/750?image=835);
	}
	.three{
		background-image: url(https://unsplash.it/1200/750?image=1074);
	}
}

.centered{
	position: absolute;
	top: 50%;
	left: 0;
	padding: 0 10%;
	transform: translateY(-50%);
}
//waypoints
.fixed{
	position: absolute;
	top: -100%;
	left: -100%;
	opacity: 0;
	transition: opacity 100ms linear;
	z-index: 0;
	margin: 0;
}
.locked{
	position: fixed;
	left: 10%;
	top: 50%;
	transform: translateY(-50%);
	opacity: 1;
	transition: opacity 100ms linear;

}

              
            
!

JS

              
                $( document ).ready(function() {
	//Waypoints
	$('.under-inner').each(function(){
		var $this = $(this);
		$this.waypoint(function(direction) {
			if (direction === 'down') {	
			  $this.children(".fixed").addClass('locked');
			}else{
			  $this.children(".fixed").removeClass('locked');
			}
		}, { offset: '60%' });
	});
	//End Waypoints
});


              
            
!
999px

Console