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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

              
                	<header class="outer page-header">
		<div class="container">
		
			<img src="https://superfantastico.co.uk/img/super-fantastico.svg" alt=" " class="page-logo pull-left" />

			
			<nav class="pull-right">
				<ul class="delist menu page-menu">
					<li>
						<a href="#">Studio</a>
					</li>
					<li>
						<a href="#">Contact</a>
					</li>					
				</ul>
				
			</nav>
						
			
		</div>
	</header>


<section class="page-content">
  <p>Some content making the page Loooong</p>
    <p>Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Nulla vitae elit libero, a pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Aenean lacinia bibendum nulla sed consectetur.</p>

<p>Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit. Nullam quis risus eget urna mollis ornare vel eu leo. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Curabitur blandit tempus porttitor. Aenean lacinia bibendum nulla sed consectetur.</p>

<p>Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Aenean lacinia bibendum nulla sed consectetur. Vestibulum id ligula porta felis euismod semper. Maecenas sed diam eget risus varius blandit sit amet non magna. Nullam quis risus eget urna mollis ornare vel eu leo. Maecenas sed diam eget risus varius blandit sit amet non magna. Curabitur blandit tempus porttitor.</p>

<p>Maecenas sed diam eget risus varius blandit sit amet non magna. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper.</p>
  
  <p>Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Nulla vitae elit libero, a pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Aenean lacinia bibendum nulla sed consectetur.</p>

<p>Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit. Nullam quis risus eget urna mollis ornare vel eu leo. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Curabitur blandit tempus porttitor. Aenean lacinia bibendum nulla sed consectetur.</p>

<p>Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Aenean lacinia bibendum nulla sed consectetur. Vestibulum id ligula porta felis euismod semper. Maecenas sed diam eget risus varius blandit sit amet non magna. Nullam quis risus eget urna mollis ornare vel eu leo. Maecenas sed diam eget risus varius blandit sit amet non magna. Curabitur blandit tempus porttitor.</p>

<p>Maecenas sed diam eget risus varius blandit sit amet non magna. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper.</p>
  
  
</section>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>

              
            
!

CSS

              
                /*
- - - basic styling - - */
body {
  margin:0;
  padding:0;
}
.page-header {
  background: #d46b41;
  padding: 1em;
  overflow:hidden;
  border-bottom: 6px solid #e27c53;
}
.page-logo {
  max-width:100px; 
  height :auto;
}
.pull-left {
  float:left;
}
.pull-right {
  float:right;
}
.menu {
   overflow:hidden;
   list-style: none;
}
.menu li {
  float:left;
  font-family:sans-serif;
  margin-left: 1em;
}
.menu li a {
  color:#fff;
  text-decoration:none;
}

.page-content {
  max-width: 600px;
  margin-left:auto;
  margin-right: auto;
  margin-top: 160px;
}
p {
  font-family: sans-serif;
  font-size: 2em;
  color: #999;
  line-height:1.3em;
}



/*
- - - Relevant to demo - - - */
.page-header {
  position: fixed;
  left:0; top:0; width:100%;
  box-sizing:border-box;
  
  transition: top 0.6s;
  
}

.page-header.off-canvas {
  top: -89px;
}
.page-header.fixed {
  top:0;
	z-index: 9999;
}







              
            
!

JS

              
                (function($){
	$(function(){	
      // scroll is still position
			var scroll = $(document).scrollTop();
			var headerHeight = $('.page-header').outerHeight();
			//console.log(headerHeight);
			
			$(window).scroll(function() {
				// scrolled is new position just obtained
				var scrolled = $(document).scrollTop();
								
				// optionally emulate non-fixed positioning behaviour
			
				if (scrolled > headerHeight){
					$('.page-header').addClass('off-canvas');
				} else {
					$('.page-header').removeClass('off-canvas');
				}

			    if (scrolled > scroll){
			         // scrolling down
					 $('.page-header').removeClass('fixed');
			      } else {
					  //scrolling up
					  $('.page-header').addClass('fixed');
			    }				
				 
				scroll = $(document).scrollTop();	
			 });
    
    
 	});
})(jQuery);   
              
            
!
999px

Console