<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('https://picsum.photos/1600/900?image=1029');
    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('https://picsum.photos/1600/900?image=991');
    position: relative;
    
    &:before { display: none; }
    

    h1 {
      font: 300 42px/1.3em @open-sans;
    }
  }
  
  &:nth-child(3) {
    background-image: url('https://picsum.photos/1600/900?image=988');
    
    h1 { font-weight: 300; margin-bottom: 1em; line-height:1.2em; }
    
    &:before { display: none; }
  }
  
  &:nth-child(4) {
    background-image: url('https://picsum.photos/1600/900?image=884');
    
    &: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=896');
    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; }
  }
}
View Compiled
/*!
**********************************************************
* 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");

External CSS

  1. https://fonts.googleapis.com/css?family=Open+Sans:400,300,700

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js
  2. https://raw.githubusercontent.com/mike-zarandona/StickyStack.js/master/jquery.stickystack.min.js