JSFiddle - React, Tailwind, and code Playground

by Craig Haywood

HTML

<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="http://cdn.tutorialzine.com/misc/enhance/v2.js"></script>
<div id="main">
  <h1>slide-out footer.</h1>
</div>
<footer>
  <ul>
    <li>
      <p>Test</p>
    </li>
    <li>
      <p>Test</p>
    </li>
    <li>
      <p>Test</p>
    </li>
    <li>
      <p>Test</p>
    </li>
  </ul>
</footer>

CSS

* {
  margin: 0;
  padding: 0;
}

body {
  font: 15px/1.3 'PT Sans', sans-serif;
  color: #5e5b64;
  position: relative;
  z-index: 0;
}

a,
a:visited {
  outline: none;
  color: #389dc1;
}

a:hover {
  text-decoration: none;
}

section,
footer,
header,
aside {
  display: block;
}

#main {
  position: relative;
  z-index: 1;
  background-color: #fff;
  padding: 120px 0 600px;
  box-shadow: 0 3px 3px rgba(0, 0, 0, 0.2);
}

#main .tzine-logo {
  width: 336px;
  height: 121px;
  margin: 0 auto 90px;
  text-indent: -999px;
  overflow: hidden;
  display: block;
}

h1 {
  font: bold 48px 'PT Sans Narrow', sans-serif;
  color: #5e5b64;
  text-align: center;
  padding-bottom: 300px;
  position: relative;
}

h1:after {
  content: '';
  width: 45px;
  height: 70px;
  position: absolute;
  left: 50%;
  bottom: -85px;
  margin-left: -23px;
}

footer {
  height: 245px;
  color: #ccc;
  font-size: 12px;
  position: relative;
  z-index: -2;
  background-color: #31353a;
}

footer > ul {
  width: 960px;
  position: fixed;
  left: 50%;
  bottom: 0;
  margin-left: -480px;
  padding-bottom: 60px;
  z-index: -1;
}

footer > ul > li {
  width: 25%;
  float: left;
}

footer ul {
  list-style: none;
}

footer > ul > li ul li {
  margin-left: 43px;
  text-transform: uppercase;
  font-weight: bold;
  line-height: 1.8;
}

footer > ul > li ul li a {
  text-decoration: none !important;
  color: #7d8691 !important;
}

footer > ul > li ul li a:hover {
  color: #ddd !important;
}

footer p {
  width: 90%;
  margin-right: 10%;
  padding: 9px 0;
  line-height: 18px;
  background-color: #058cc7;
  font-weight: bold;
  font-size: 14px;
  color: #fff;
  text-transform: uppercase;
  text-shadow: 0 1px rgba(0, 0, 0, 0.1);
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
  margin-bottom: 20px;
  opacity: 0.9;
  cursor: default;
  -webkit-transition: opacity 0.4s;
  -moz-transition: opacity 0.4s;
  transition: opacity 0.4s;
}

footer > ul > li:hover p {
  opacity: 1;
}

footer p:before {
  content: '';
 ...

JavaScript

// Hide Header on on scroll down
var didScroll;
var lastScrollTop = 0;
var delta =99;
var navbarHeight = $('footer').outerHeight();

$(window).scroll(function(event) {
  didScroll = true;
});

setInterval(function() {
  if (didScroll) {
    hasScrolled();
    didScroll = false;
  }
}, 250);

function hasScrolled() {
  var st = $(this).scrollTop();

  // Make sure they scroll more than delta
  if (Math.abs(lastScrollTop - st) <= delta)
    return;

  // If they scrolled down and are past the navbar, add class .nav-up.
  // This is necessary so you never see what is "behind" the navbar.
  if (st > lastScrollTop && st > navbarHeight) {
    // Scroll Down
    $('footer').removeClass('nav-down').addClass('nav-up');
  } else {
    // Scroll Up
    if (st + $(window).height() < $(document).height()) {
      $('footer').removeClass('nav-up').addClass('nav-down');
    }
  }

  lastScrollTop = st;
}