Footer animation

In this example below you will see how to do a Footer animation with some HTML / CSS and Javascript

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

Technologies

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

<head>
  <meta charset="UTF-8">
  <title>Footer animation</title>
  
  
  
      <link rel="stylesheet" href="css/style.css">

  
</head>

<body>

  <header></header>
<section></section>
<footer>
  <div class='first-row'>
    <div class='prog-details'>
      <div class='img'></div>
      <span class='txt'>small lines of text</span>
      <span class='txt'>that are turned</span>
      <span class='txt'>into blocks</span>
      <span class='txt'>for mockup purposes</span>
    </div>
    <div class='menu'>
      <ul class='menu-list'>
        <li class='txt'>A</li>
        <li class='txt'>B</li>
        <li class='txt'>C</li>
        <li class='txt'>D</li>
        <li class='txt'>E</li>
        <li class='txt'>F</li>
        <li class='txt'>G</li>
        <li class='txt'>H</li>
        <li class='txt'>I</li>
        <li class='txt'>J</li>
        <li class='txt'>K</li>
        <li class='txt'>L</li>
      </ul>
    </div>
  </div>
  <div class='second-row'>
    <ul>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
    </ul>
  </div>
</footer>
  <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.2/jquery.min.js'></script>

  

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




</body>

</html>

/*Downloaded from https://www.codeseek.co/candroo/footer-animation-mROMWN */
body,
html {
  background: #323b40;
  height: 100vh;
  overflow: hidden;
  margin: 0;
  padding: 0;
}
section {
  background: url(http://s4c.cymru/amg/iplayer/3_lle_2016_alex_jones.jpg);
  background-size: cover;
  bottom: 0;
  left: 0;
  opacity: 0.7;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 0;
}
section {
  -webkit-transform: translate3d(0, 0, 0);
          transform: translate3d(0, 0, 0);
  transition: all 0.2s 0s cubic-bezier(0.65, 0.19, 0.94, 0.55);
}
footer {
  background: #e9eaea;
  height: 540px;
  left: 0;
  overflow: hidden;
  position: absolute;
  right: 0;
  top: 100%;
  -webkit-transform: translate3d(0, -160px, 0);
          transform: translate3d(0, -160px, 0);
  transition: all 0.2s 0s cubic-bezier(0.65, 0.19, 0.94, 0.55);
  transition-delay: 0.3s;
}
footer .first-row {
  height: 160px;
}
footer .first-row .prog-details {
  padding: 30px;
  position: relative;
  transition: all 0.2s 0s cubic-bezier(0.65, 0.19, 0.94, 0.55);
  width: 360px;
  z-index: 1;
}
footer .first-row .prog-details .img {
  background: #b8bcbd;
  float: left;
  height: 100px;
  margin-right: 20px;
  width: 168px;
}
footer .first-row .prog-details span {
  white-space: nowrap;
}
footer .menu {
  background: #e9eaea;
  border-left: 2px solid #b8bcbd;
  height: 100px;
  left: 460px;
  padding: 60px 0 0 80px;
  position: absolute;
  top: 0;
  transition: all 0.2s 0s cubic-bezier(0.65, 0.19, 0.94, 0.55);
  z-index: 10;
}
footer .menu ul {
  margin: 0;
  padding: 0;
  min-width: 1020px;
}
footer .menu ul li {
  border-radius: 2px;
  cursor: pointer;
  display: inline-block;
  height: 40px;
  list-style: none;
  margin: 0 25px 0 0;
  padding: 0;
  width: 40px;
}
footer .menu ul li:hover {
  background: #808080;
  color: #808080;
}
footer .menu ul li.on {
  background: #4f585e;
  color: #4f585e;
}
footer .second-row ul {
  margin: 0;
  padding: 60px 30px 0 30px;
  white-space: nowrap;
}
footer .second-row ul li {
  background: #b8bcbd;
  display: inline-block;
  margin: 0 30px 0 0;
  opacity: 0;
  padding: 0;
  height: 280px;
  width: 224px;
  -webkit-transform: translate3d(300px, 0, 0);
          transform: translate3d(300px, 0, 0);
  transition: all 0.2s 0s cubic-bezier(0.65, 0.19, 0.94, 0.55);
}
footer .second-row ul li:nth-child(1) {
  transition-delay: 0.4s;
}
footer .second-row ul li:nth-child(2) {
  transition-delay: 0.5s;
}
footer .second-row ul li:nth-child(3) {
  transition-delay: 0.6s;
}
footer .second-row ul li:nth-child(4) {
  transition-delay: 0.7s;
}
footer .second-row ul li:nth-child(5) {
  transition-delay: 0.8s;
}
footer .second-row ul li:nth-child(6) {
  transition-delay: 0.9s;
}
footer .second-row ul li:nth-child(7) {
  transition-delay: 1.0s;
}
footer .second-row ul li:nth-child(8) {
  transition-delay: 1.1s;
}
footer .second-row ul li:first-child {
  width: 472px;
}
footer.open {
  -webkit-transform: translate3d(0, -540px, 0);
          transform: translate3d(0, -540px, 0);
  transition: all 0.3s cubic-bezier(0.15, 0.64, 0.41, 0.94);
  transition-delay: 0.3s;
}
footer.open .prog-details {
  opacity: 0.35;
  transition: all 0.3s cubic-bezier(0.15, 0.64, 0.41, 0.94);
}
footer.open .menu {
  left: 60px;
  transition: all 0.3s cubic-bezier(0.15, 0.64, 0.41, 0.94);
}
footer.open .second-row ul li {
  opacity: 1;
  -webkit-transform: translate3d(0, 0, 0);
          transform: translate3d(0, 0, 0);
  transition: all 0.3s cubic-bezier(0.15, 0.64, 0.41, 0.94);
}
footer.open .second-row ul li:nth-child(1) {
  transition-delay: 0.5s;
}
footer.open .second-row ul li:nth-child(2) {
  transition-delay: 0.6s;
}
footer.open .second-row ul li:nth-child(3) {
  transition-delay: 0.7s;
}
footer.open .second-row ul li:nth-child(4) {
  transition-delay: 0.8s;
}
footer.open .second-row ul li:nth-child(5) {
  transition-delay: 0.9s;
}
footer.open .second-row ul li:nth-child(6) {
  transition-delay: 1.0s;
}
footer.open .second-row ul li:nth-child(7) {
  transition-delay: 1.1s;
}
footer.open .second-row ul li:nth-child(8) {
  transition-delay: 1.2s;
}
section.open {
  opacity: 0.05;
}
.txt {
  background: #b8bcbd;
  color: #b8bcbd;
  line-height: 1.4em;
}


/*Downloaded from https://www.codeseek.co/candroo/footer-animation-mROMWN */
$(function() {

	var footerElem = $("footer"),
			sectionElem = $("section");

	$(document).click(function(event) { 
			$(".on").removeClass("on");
			if (!$(event.target).closest('footer').length) {
				footerElem.removeClass("open");
				sectionElem.removeClass("open");
			}  else {
				if ($(event.target).closest('ul.menu-list').length) {
					$(event.target).addClass("on");
					footerElem.addClass("open");
					sectionElem.addClass("open");
				}
			}      
	})
	
});

Comments