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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

            
              <div class="main-content-wrapper">
  <!-- section 1 -->
  <section id="one">
    <h1>StickyStack.js</h1>
    <p class="helper">A jQuery plugin that creates a <em>stacking</em> effect by <em>sticking</em> panels as they reach the top of the viewport.</p>
    <br />
    <div class="button-wrapper">
      <a href="github.com/mike-zarandona/StickyStack.js/archive/master.zip" class="btn">Download</a>
      <a href="https://github.com/mike-zarandona/StickyStack.js" class="btn" target="_blank">GitHub</a>
    </div><!--/.button-wrapper-->
  </section>

  <!-- section 2-->
  <section id="two">
    <div class="shadow">
      <h1>Long pages feel like a stack of cards</h1>
     </div><!--/.shadow-->
  </section>

  <!-- section 3 -->
  <section>
    <div class="shadow">
      <h1>Usage</h1>
      <p><code><pre>$('.main-content-wrapper').stickyStack();
      </pre></code></p>
    </div>
  </section>
    
  <!-- section 4 -->
  <section>
    <div class="shadow">
    <h1>Options</h1>
      <p><code><pre>$('.main-content-wrapper').stickyStack({
  containerElement: '.main-content-wrapper',
  stackingElement: 'section',
  boxShadow: '0 -3px 20px rgba(0, 0, 0, 0.25)'
});
      </pre></code></p>
    </div><!--/.shadow-->
    
  </section>

  <section>
    <p>Enjoy.</p>
    <div class="button-wrapper">
      <a href="https://github.com/mike-zarandona/StickyStack.js/archive/master.zip" class="btn">Download</a>
      <a href="https://github.com/mike-zarandona/StickyStack.js" class="btn" target="_blank">GitHub</a>
    </div><!--/.button-wrapper-->
    <small>by <a href="https://twitter.com/mikezarandona" target="_blank">mike zarandona</a></small>
  </section>
</div><!--/.main-content-wrapper-->
            
          
!
            
              @import "lesshat";

@open-sans: 'Open Sans', sans-serif;

body { font: 16px/1.5em 'Open Sans', @open-sans; }

a {
  color: #fff;
  .transition(all 300ms);

  &:hover {
    background-color: #fff;
    color: #111;
  }
}

small {
  font-size: 10px;
  clear: both;
  display: block;
}

section {
  background-color: #303030;
  color: #fff;
  padding: 1em 2em;
  .box-sizing(border-box);
  background-size: cover;
  background-position: 50% 50%;
  display: block;
  
  &.stuck + section:not(.stuck) {
    box-shadow: 0 -3px 20px rgba(0, 0, 0, 0.5);
  }
    
  &:before {
    content: '';
    display: block;
    position: absolute;
    background-color: rgba(0, 0, 0, 0.65);
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
  }
  &:nth-child(1) {
    pading-top: 200px;
    text-align: center;
    background-image: url('http://unsplash.it/1600/900?image=910');
    background-size: cover;
    background-position: 50% 50%;
    position: relative;
    
    h1 {
      margin-top: 160px;
      margin-bottom: 0;
      line-height: 1em;
      font: 300 48px/1.2em @open-sans;
    }
    
    .helper {
      font-size: 14px;
      width: 50%;
      margin: 1em auto;
      line-height: 1.5em;
    }
  }
  
  &:nth-child(2) {
    background-image: url('http://unsplash.it/1600/900?image=897');
    position: relative;
    
    &:before { display: none; }
    

    h1 {
      font: 300 42px/1.3em @open-sans;
    }
  }
  
  &:nth-child(3) {
    background-image: url('http://unsplash.it/1600/900?image=890');
    
    h1 { font-weight: 300; margin-bottom: 1em; line-height:1.2em; }
    
    &:before { display: none; }
  }
  
  &:nth-child(4) {
    background-image: url('http://unsplash.it/1600/900?image=876');
    
    &:before { display: none; }
    
    .shadow {
      position: absolute;
      bottom: 40px;
      left: 20px;
    }
    
    h1 {
      font-weight: 300;
      line-height: 1.2em;
    }
  }
  
  &:nth-child(5) {
    background-image: url('http://unsplash.it/1600/900?image=873');
    background-position: 50% 100%;
    padding-top: 30%;
    text-align: center;
  }
} 



/* Modular Styles */
h1 {
  font-size: 3em;
}

.button-wrapper {
  margin: 0 auto;
  padding: 0px;
  width: 320px;
  position: relative;
  clear: both;
  
  .btn + .btn { margin-left: -4px; }
}

.btn {
  padding: 10px;
  font: bold 16px/1.2em sans-serif;
  border: 2px solid #fff;
  .border-radius(3px);
  background-color: transparent;
  text-decoration: none;
  margin: 0.5em auto;
  color: #fff;
  .transition(300ms all);
  display: inline-block;
  box-sizing: border-box;
  width: 49%;  
  
  &:hover {
    background-color: fade(#fff, 33%);
    color: #fff;
    text-shadow: 0 1px 0 #111;
  }

  &:first-of-type {
    margin-right: 2%;
  }
  &:last-of-type {
  }
}

.shadow {
  background-color: rgba(0, 0, 0, 0.8);
  padding: 1em;
  border-radius: 5px;
  
  &:after { display: none; }
  
  h1, h2, h3 {
    &:first-of-type { margin-top: 0; margin-bottom: 10px; }
  }
}
            
          
!
            
              /*!
**********************************************************
* StickyStack.js
* 
* Version:		v1.1.2
* Author:		Mike Zarandona
* Release:		June 24 2014
* 				Added a fix for sections that are taller than the screen
* 
* Reqs:			jQuery
* 
* Usage:		$('.main-content-wrapper').stickyStack({
*					containerElement:	'.main-content-wrapper',
*					stackingElement:	'section',
*					boxShadow:			'0 -3px 20px rgba(0, 0, 0, 0.25)'
*				});
**********************************************************
*/
!function(a,b){a.fn.stickyStack=function(b){function f(a){for(var b=0,d=0;d<a;d++)b+=c.eq(d).outerHeight(!0);c.eq(0).parent().css("padding-top",b);for(var e=0;e<c.length;e++)a>0?(c.eq(e).addClass("stuck"),a--):c.eq(e).removeClass("stuck")}function g(){for(var b=0,e=a(window).outerHeight(!0),f=0;f<c.length;f++)d[f]=[],d[f][1]=c.eq(f).outerHeight(!0),d[f][1]>e?(d[f][2]=d[f][1]-e,c.eq(f).addClass("align-bottom")):(d[f][2]=0,c.eq(f).removeClass("align-bottom")),c.eq(f).attr("data-scrollto",c.eq(f).offset().top),c.eq(f).hasClass("stuck")?(d[f][0]=b,b+=d[f][1]):d[f][0]=c.eq(f).offset().top,c.eq(f).attr("data-scrollto",d[f][0]).attr("data-height",d[f][1]).attr("data-offset",d[f][2])}b=a.extend({},a.fn.stickyStack.options,b);var c=a(b.containerElement+" > "+b.stackingElement),d=[],e=b.stackingElement+"{box-sizing: border-box;-moz-box-sizing: border-box;position: relative;z-index: 100;}"+b.stackingElement+".stuck {position: fixed;top: 0;z-index: 0;}"+b.stackingElement+".stuck + "+b.stackingElement+":not(.stuck) {box-shadow: "+b.boxShadow+";}"+b.stackingElement+".stuck.align-bottom {top: auto !important;bottom: 0 !important;}";a("head").append('<style id="sticky-stack-styles" type="text/css">'+e+"</style>"),a(document).ready(function(){g();var a=c.eq(0).outerWidth(!0);c.css("width",a+"px")}),a(window).on("scroll",function(){for(var b=a(window).scrollTop(),e=0,g=0;g<c.length;g++)0!=c.eq(g).attr("data-offset")?b>=d[g][2]+d[g][0]&&e++:b>=d[g][0]&&e++;f(e)}),a(window).on("resize",function(){c.css("width",a(b.containerElement).width()+"px"),g()})},a.fn.stickyStack.options={containerElement:".main-content-wrapper",stackingElement:"section",boxShadow:"0 -3px 20px rgba(0, 0, 0, 0.25)"}}(jQuery);


$(window).load(function() {
  $('section').css('min-height', $(window).height());

  $('.main-content-wrapper').stickyStack();
});




// analytics
(function(d,e,j,h,f,c,b){d.GoogleAnalyticsObject=f;d[f]=d[f]||function(){(d[f].q=d[f].q||[]).push(arguments)},d[f].l=1*new Date();c=e.createElement(j),b=e.getElementsByTagName(j)[0];c.async=1;c.src=h;b.parentNode.insertBefore(c,b)})(window,document,"script","//www.google-analytics.com/analytics.js","ga");ga("create","UA-53573814-1","auto");ga("send","pageview");

            
          
!
999px
Loading ..................

Console