Multiple Sticky Headers

In this example below you will see how to do a Multiple Sticky Headers with some HTML / CSS and Javascript

This demo implements a bunch of sticky (instagram-like) headers with anything on 'em (i.e. buttons, inputs, etc.). Implemented in SASS, HAML and CoffeeScript.

Thumbnail
This awesome code was written by ipelekhan, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright ipelekhan ©

Technologies

  • HTML
  • CSS
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>Multiple Sticky Headers</title>
  
  
  <link rel='stylesheet prefetch' href='http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css'>

      <link rel="stylesheet" href="css/style.css">

  
</head>

<body>

  <br>
<br>
<br>
<br>
<div class='container single-item'>
  <div class='sticky-header badass'>
    <div class='row'>
      <div class='span12'>
        <div class='some-title'>
          <h3>
            Some title A
          </h3>
        </div>
        <div class='some-controls pull-right'>
          <a class='btn btn-success' href='#'>
            <i class='icon-ok icon-white'></i>
          </a>
          <a class='btn btn-danger' href='#'>
            <i class='icon-fire icon-white'></i>
          </a>
        </div>
      </div>
    </div>
  </div>
  <div class='some-content'>
    <div class='jumbotron'>
      <h1>
        Super awesome content title!
      </h1>
      <p class='lead'>
        Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.
      </p>
      <a class='btn btn-large btn-success' href='#'>Sign up today</a>
    </div>
    <hr>
    <div class='row'>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
    </div>
    <hr>
    <div class='row'>
      <div class='span6'>
        <h4>
          Some heading
        </h4>
        <p>
          Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Cras mattis consectetur purus sit amet fermentum.
        </p>
      </div>
      <div class='span6'>
        <h4>
          Another heading
        </h4>
        <p>
          Donec id elit non mi porta gravida at eget metus. Maecenas faucibus mollis interdum.
        </p>
      </div>
    </div>
    <div class='row'>
      <div class='span6'>
        <h4>
          Some heading
        </h4>
        <p>
          Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Cras mattis consectetur purus sit amet fermentum.
        </p>
      </div>
      <div class='span6'>
        <h4>
          Another heading
        </h4>
        <p>
          Donec id elit non mi porta gravida at eget metus. Maecenas faucibus mollis interdum.
        </p>
      </div>
    </div>
    <div class='row'>
      <div class='span6'>
        <h4>
          Some heading
        </h4>
        <p>
          Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Cras mattis consectetur purus sit amet fermentum.
        </p>
      </div>
      <div class='span6'>
        <h4>
          Another heading
        </h4>
        <p>
          Donec id elit non mi porta gravida at eget metus. Maecenas faucibus mollis interdum.
        </p>
      </div>
    </div>
    <div class='row'>
      <div class='span6'>
        <h4>
          Some heading
        </h4>
        <p>
          Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Cras mattis consectetur purus sit amet fermentum.
        </p>
      </div>
      <div class='span6'>
        <h4>
          Another heading
        </h4>
        <p>
          Donec id elit non mi porta gravida at eget metus. Maecenas faucibus mollis interdum.
        </p>
      </div>
    </div>
  </div>
</div>
<div class='container single-item'>
  <div class='sticky-header delete'>
    <div class='row'>
      <div class='span12'>
        <div class='some-title'>
          <h3>
            Some title B
          </h3>
        </div>
        <div class='some-controls pull-right'>
          <a class='btn btn-success' href='#'>
            <i class='icon-ok icon-white'></i>
          </a>
          <a class='btn btn-danger' href='#'>
            <i class='icon-fire icon-white'></i>
          </a>
        </div>
      </div>
    </div>
  </div>
  <div class='some-content'>
    <div class='hero-unit'>
      <h1>
        Hello, world!
      </h1>
      <p>
        Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
      </p>
      <p>
        <a class='btn btn-primary btn-large' href='#'>
          Learn more &raquo
        </a>
      </p>
    </div>
    <div class='row'>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
    </div>
    <div class='row'>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
    </div>
    <div class='row'>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
    </div>
    <div class='row'>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
    </div>
  </div>
</div>
<div class='container single-item'>
  <div class='sticky-header nineeleven'>
    <div class='row'>
      <div class='span12'>
        <div class='some-title'>
          <h3>
            Some title C
          </h3>
        </div>
        <div class='some-controls pull-right'>
          <a class='btn btn-success' href='#'>
            <i class='icon-ok icon-white'></i>
          </a>
          <a class='btn btn-danger' href='#'>
            <i class='icon-fire icon-white'></i>
          </a>
        </div>
      </div>
    </div>
  </div>
  <div class='some-content'>
    <div class='jumbotron'>
      <h1>
        Super awesome content title!
      </h1>
      <p class='lead'>
        Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.
      </p>
      <a class='btn btn-large btn-success' href='#'>Sign up today</a>
    </div>
    <hr>
    <div class='row'>
      <div class='span6'>
        <h4>
          Some heading
        </h4>
        <p>
          Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Cras mattis consectetur purus sit amet fermentum.
        </p>
      </div>
      <div class='span6'>
        <h4>
          Another heading
        </h4>
        <p>
          Donec id elit non mi porta gravida at eget metus. Maecenas faucibus mollis interdum.
        </p>
      </div>
    </div>
    <hr>
    <div class='row'>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
    </div>
    <div class='row'>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
    </div>
    <div class='row'>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
    </div>
  </div>
</div>
<div class='container single-item'>
  <div class='sticky-header office'>
    <div class='row'>
      <div class='span12'>
        <div class='some-title'>
          <h3>
            Some title D
          </h3>
        </div>
        <div class='some-controls pull-right'>
          <a class='btn btn-success' href='#'>
            <i class='icon-ok icon-white'></i>
          </a>
          <a class='btn btn-danger' href='#'>
            <i class='icon-fire icon-white'></i>
          </a>
        </div>
      </div>
    </div>
  </div>
  <div class='some-content'>
    <div class='hero-unit'>
      <h1>
        Hello, world!
      </h1>
      <p>
        Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
      </p>
      <p>
        <a class='btn btn-primary btn-large' href='#'>
          Learn more &raquo
        </a>
      </p>
    </div>
    <div class='row'>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
    </div>
    <div class='row'>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
    </div>
    <div class='row'>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
    </div>
    <div class='row'>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
      <div class='span4'>
        <h2>Heading</h2>
        <p>
          Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui.
        </p>
        <p>
          <a class='btn' href='#'>
            View details &raquo
          </a>
        </p>
      </div>
    </div>
  </div>
</div>
  <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>

  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/ipelekhan/multiple-sticky-headers-Gebnf */
.single-item {
  position: relative;
}

.sticky-header {
  border-bottom: 1px solid black;
  height: 60px;
  line-height: 60px;
  margin-bottom: 20px;
}
.sticky-header .some-title {
  padding-left: 15px;
  display: inline-block;
}
.sticky-header .some-controls {
  padding-right: 15px;
  display: inline-block;
}

.some-content {
  margin-bottom: 30px;
}

.office {
  background-color: #e8fefa;
}

.badass {
  background-color: #e5f1be;
}

.delete {
  background-color: #fce6f1;
}

.nineeleven {
  background-color: #f9c9c9;
}


/*Downloaded from https://www.codeseek.co/ipelekhan/multiple-sticky-headers-Gebnf */
(function() {
  var updateHeaders;

  updateHeaders = function() {
    return $('.single-item').each(function() {
      var el, floatingHeader, offset, scrollTop;
      el = $(this);
      offset = el.offset();
      scrollTop = $(window).scrollTop();
      floatingHeader = $('.floating-header', this);
      if ((scrollTop > offset.top) && (scrollTop < offset.top + el.height() - floatingHeader.height())) {
        floatingHeader.css('visibility', 'visible');
        floatingHeader.css('position', 'fixed');
        return floatingHeader.css('top', '0px');
      } else if (scrollTop < offset.top) {
        return floatingHeader.css('visibility', 'hidden');
      } else {
        floatingHeader.css('position', 'absolute');
        return floatingHeader.css('top', el.height() - floatingHeader.outerHeight() + 'px');
      }
    });
  };

  $(function() {
    $('.single-item').each(function(i) {
      var clonedHeader, thisHeader;
      thisHeader = $('.sticky-header', this);
      clonedHeader = thisHeader.clone();
      thisHeader.before(clonedHeader);
      clonedHeader.addClass('floating-header');
      clonedHeader.css('position', 'fixed');
      clonedHeader.css('width', thisHeader.width());
      clonedHeader.css('top', '0px');
      return clonedHeader.css('visibility', 'hidden');
    });
    updateHeaders();
    return $(window).scroll(updateHeaders);
  });

}).call(this);

//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiPGFub255bW91cz4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUFBQSxNQUFBOztFQUFBLGFBQUEsR0FBZ0IsUUFBQSxDQUFBLENBQUE7V0FDZCxDQUFBLENBQUUsY0FBRixDQUFpQixDQUFDLElBQWxCLENBQXVCLFFBQUEsQ0FBQSxDQUFBO0FBQ3JCLFVBQUEsRUFBQSxFQUFBLGNBQUEsRUFBQSxNQUFBLEVBQUE7TUFBQSxFQUFBLEdBQUssQ0FBQSxDQUFFLElBQUY7TUFDTCxNQUFBLEdBQVMsRUFBRSxDQUFDLE1BQUgsQ0FBQTtNQUNULFNBQUEsR0FBWSxDQUFBLENBQUUsTUFBRixDQUFTLENBQUMsU0FBVixDQUFBO01BQ1osY0FBQSxHQUFpQixDQUFBLENBQUUsa0JBQUYsRUFBc0IsSUFBdEI7TUFFakIsSUFBRyxDQUFDLFNBQUEsR0FBWSxNQUFNLENBQUMsR0FBcEIsQ0FBQSxJQUE2QixDQUFDLFNBQUEsR0FBWSxNQUFNLENBQUMsR0FBUCxHQUFhLEVBQUUsQ0FBQyxNQUFILENBQUEsQ0FBYixHQ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