Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!--For our animations to look good, the animated elements need to be able to be scrolled to. For this example I've added dummy content to the top -->
<div class="main-container">
  <div class="container">
    <h1>Multi-step animation</h1>
    <p>This animation will focus on fade in and up an element when it comes into the focus of the viewer. </p>
  </div>
  <div class="container">
    <h2>Gallery Images</h2>
    <p>Here we keep some of our latest images and designs. </p>
  </div>

  <div class="container cf">
    <!-- Staff 1 -->
    <div class="animation-element multi-step-left cf">
      <div class="gallery">
        <h3 class="title">Johnthon Smith</h3>
        <h4 class="subtitle">Senior Enginer</h4>
        <div class="image" style="background-image: url(https://drive.google.com/uc?export=download&id=0B7UPM0QugWUjVTdZcktRTWhNamM)">
          <div class="social">
            <i class="fa fa-facebook"></i>
            <i class="fa fa-twitter"></i>
            <i class="fa fa-google-plus"></i>
            <i class="fa fa-envelope"></i>
          </div>
        </div>
        <h5 class="image-caption">
          <i class="fa fa-quote-left"></i>
          Always find something new to learn every day
          <i class="fa fa-quote-right"></i>
        </h5>
        <div class="readmore">View profile</i>
          </i>
        </div>
      </div>
    </div>
    <!-- Staff 2 -->
    <div class="animation-element multi-step-right cf">
      <div class="gallery">
        <h3 class="title">Jillian Jules</h3>
        <h4 class="subtitle">Marketing</h4>
        <div class="image" style="background-image: url(https://drive.google.com/uc?export=download&id=0B7UPM0QugWUjb1dxcGZEYUc0Z3M)">
          <div class="social">
            <i class="fa fa-facebook"></i>
            <i class="fa fa-twitter"></i>
            <i class="fa fa-google-plus"></i>
            <i class="fa fa-envelope"></i>
          </div>
        </div>
        <h5 class="image-caption">
          <i class="fa fa-quote-left"></i>
          Find new creative areas to expand
          <i class="fa fa-quote-right"></i>
        </h5>
        <div class="readmore">View profile</i>
          </i>
        </div>
      </div>
    </div>
    <!-- Staff 3 -->
    <div class="animation-element multi-step-left cf">
      <div class="gallery">
        <h3 class="title">James O'Keffe</h3>
        <h4 class="subtitle">Manager</h4>
        <div class="image" style="background-image: url(https://drive.google.com/uc?export=download&id=0B7UPM0QugWUjTURta0pyMEtoUmc)">
          <div class="social">
            <i class="fa fa-facebook"></i>
            <i class="fa fa-twitter"></i>
            <i class="fa fa-google-plus"></i>
            <i class="fa fa-envelope"></i>
          </div>
        </div>
        <h5 class="image-caption">
          <i class="fa fa-quote-left"></i>
          Expanding possibilities with determination
          <i class="fa fa-quote-right"></i>
        </h5>
        <div class="readmore">View profile</i>
          </i>
        </div>
      </div>
    </div>
    <!-- Staff 4 -->
    <div class="animation-element multi-step-right cf">
      <div class="gallery">
        <h3 class="title">Vivian Rymer</h3>
        <h4 class="subtitle">HR</h4>
        <div class="image" style="background-image: url(https://drive.google.com/uc?export=download&id=0B7UPM0QugWUjV3BseTMtcEU1T2M)">
          <div class="social">
            <i class="fa fa-facebook"></i>
            <i class="fa fa-twitter"></i>
            <i class="fa fa-google-plus"></i>
            <i class="fa fa-envelope"></i>
          </div>
        </div>
        <h5 class="image-caption">
          <i class="fa fa-quote-left"></i>
          Increasing skills, determination and workplace unity
          <i class="fa fa-quote-right"></i>
        </h5>
        <div class="readmore">View profile</i>
          </i>
        </div>
      </div>
    </div>

  </div>
              
            
!

CSS

              
                /*These styles contain basic styles for fomatting along with our animation css*/

body {
  font-size: 16px;
  font-family: 'Open Sans', sans-serif;
  font-weight: 400;
  background: #efefef;
  line-height: 170%;
  overflow-x: hidden;
}

strong,
b {
  font-weight: 600
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 300;
  line-height: 150%;
}

*,
*:before,
*:after {
  box-sizing: border-box;
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
}
/*clearfixes*/

.cf:before,
.cf:after {
  content: " ";
  display: table;
}

.cf:after {
  clear: both;
}

.main-container {
  background: #fff;
  max-width: 1000px;
  margin: 25px auto 25px auto;
  position: relative;
}

.container {
  position: relative;
  padding: 25px;
}

.container:last-of-type {
  padding-top: 0px;
}
/*animation element*/

.animation-element {
  position: relative;
  width: 22%;
  margin: 0% 1.5% 3% 1.5%;
  float: left;
}
/*4 grid layout*/

.animation-element:nth-of-type(4n-3) {
  clear: left;
}

.animation-element:nth-of-type(4n-2) {}

.animation-element:nth-of-type(4n-1) {}

.animation-element:nth-of-type(4n-0) {
  clear: right;
}
/*left fancy animastion*/

@-moz-keyframes left_animation {
  0% {
    opacity: 0;
    -moz-transform: rotate(180deg) translate3d(100%, 100%, 0);
  }
  75% {
    opacity: 0.8;
    -moz-transform: rotate(-40deg);
  }
  100% {
    opacity: 1;
    -moz-transform: rotate(0deg) translate3d(0%, 0%, 0);
  }
}

@-webkit-keyframes left_animation {
  0% {
    opacity: 0;
    -webkit-transform: rotate(180deg) translate3d(100%, 100%, 0);
  }
  75% {
    opacity: 0.8;
    -webkit-transform: rotate(-40deg);
  }
  100% {
    opacity: 1;
    -webkit-transform: rotate(0deg) translate3d(0%, 0%, 0);
  }
}

@keyframes left_animation {
  0% {
    opacity: 0;
    transform: rotate(180deg) translate3d(100%, 100%, 0);
  }
  75% {
    opacity: 0.8;
    transform: rotate(-40deg);
  }
  100% {
    opacity: 1;
    transform: rotate(0deg) translate3d(0%, 0%, 0);
  }
}
/*right fancy animation*/

@-moz-keyframes right_animation {
  0% {
    opacity: 0;
    -moz-transform: rotate(180deg) translate3d(-100%, -100%, 0);
  }
  75% {
    opacity: 0.8;
    -moz-transform: rotate(40deg);
  }
  100% {
    opacity: 1;
    -moz-transform: rotate(0deg) translate3d(0%, 0%, 0);
  }
}

@-webkit-keyframes right_animation {
  0% {
    opacity: 0;
    -webkit-transform: rotate(180deg) translate3d(-100%, 100%, 0);
  }
  75% {
    opacity: 0.8;
    -webkit-transform: rotate(40deg);
  }
  100% {
    opacity: 1;
    -webkit-transform: rotate(0deg) translate3d(0%, 0%, 0);
  }
}

@keyframes right_animation {
  0% {
    opacity: 0;
    transform: rotate(180deg) translate3d(-100%, -100%, 0);
  }
  75% {
    opacity: 0.8;
    transform: rotate(40deg);
  }
  100% {
    opacity: 1;
    transform: rotate(0deg) translate3d(0%, 0%, 0);
  }
}
/*Multi-step animation*/

.multi-step-left .gallery,
.multi-step-right .gallery {
  position: relative;
  opacity: 0;
  /*prevents flicker as animation occurs*/
}

.multi-step-left.in-view .gallery {
  -moz-animation: left_animation 1300ms ease-in both;
  -webkit-animation: left_animation 1300ms ease-in both;
  animation: left_animation 1300ms ease-in both;
}

.multi-step-right.in-view .gallery {
  -moz-animation: right_animation 1300ms linear both;
  -webkit-animation: right_animation 1300ms linear both;
  animation: right_animation 1300ms linear both;
}

.gallery {
  float: left;
  width: 100%;
  height: auto;
  margin: 0% 1.33% 2.66% 1.33%;
}

.gallery .image {
  background: #F5F5F5;
  border: solid 1px #EAEAEA;
  height: 0px;
  width: 80%;
  width: calc(100% - 40px);
  padding-bottom: 100%;
  padding-bottom: calc(100% - 40px);
  background-size: cover;
  background-position: bottom center;
  position: relative;
  border-radius: 50%;
  margin-bottom: 10px;
}

.gallery:hover .image,
.gallery:active .image {}

.gallery .image-caption {
  position: relative;
  background: #fff;
  background: #efefef;
  color: #333;
  font-size: 95%;
  padding: 10px;
  margin: 0px 0px 10px 0px;
}

.gallery .image-caption i {
  color: #aaa;
  margin: 0px 7px 0px 0px;
  display: inline-block;
}

.gallery .image-caption i:last-child {
  margin: 0px 0px 0px 7px;
}

.gallery .readmore {
  padding: 5px 12px;
  cursor: pointer;
  text-align: center;
  background: #2c3e50;
  color: #fff;
  font-size: 90%;
  -moz-transition: all 350ms ease;
  -o-transition: all 350ms ease;
  -webkit-transition: all 350ms ease;
  transition: all 350ms ease;
}

.gallery .readmore:hover,
.gallery .readmore:active {
  background: #34495e;
}

.gallery .title {
  margin: 0px 0px 5px 0px;
  text-align: center;
  color: #2c3e50;
  font-weight: 400;
}

.gallery .subtitle {
  margin: 0px 0px 10px 0px;
  text-align: center;
}

.gallery .social {
  position: absolute;
  top: 0px;
  right: -40px;
  width: calc(35px);
}

.gallery .social i {
  width: 100%;
  display: block;
  text-align: center;
  height: 35px;
  font-size: 125%;
  background: #2c3e50;
  line-height: 35px;
  border-radius: 50%;
  color: rgb(255, 255, 255);
  margin-bottom: 5px;
  cursor: pointer;
  -moz-transition: all 350ms ease;
  -o-transition: all 350ms ease;
  -webkit-transition: all 350ms ease;
  transition: all 350ms ease;
}

.gallery .social i:hover,
.gallery .social i:active {
  background: #34495e;
}
/*media queries for small devices*/

@media screen and (max-width: 678px) {
  .main-container {
    margin: 25px;
  }
  .animation-element,
  .animation-element:nth-of-type(4n-3),
  .animation-element:nth-of-type(4n-2),
  .animation-element:nth-of-type(4n-1),
  .animation-element:nth-of-type(4n-0) {
    width: 100%;
    margin: 0% 0% 25px 0%;
  }
}
              
            
!

JS

              
                var $animation_elements = $('.animation-element');
var $window = $(window);

function check_if_in_view() {
  var window_height = $window.height();
  var window_top_position = $window.scrollTop();
  var window_bottom_position = (window_top_position + window_height);

  $.each($animation_elements, function() {
    var $element = $(this);
    var element_height = $element.outerHeight();
    var element_top_position = $element.offset().top;
    var element_bottom_position = (element_top_position + element_height);

    //check to see if this current container is within viewport
    if ((element_bottom_position >= window_top_position) &&
      (element_top_position <= window_bottom_position)) {
      $element.addClass('in-view');
    } else {
      $element.removeClass('in-view');
    }
  });
}

$window.on('scroll resize', check_if_in_view);
$window.trigger('scroll');
              
            
!
999px

Console