<div id="container">
  <div class="panels">
      <div class="panel panel1">
          <p>Hey</p>
          <p>Let's</p>
          <p>Party</p>
      </div>
      <div class="panel panel2">
          <p>Give</p>
          <p>Take</p>
          <p>Receive</p>
      </div>
      <div class="panel panel3">
          <p>Experience</p>
          <p>It</p>
          <p>Today</p>
      </div>
      <div class="panel panel4">
          <p>Give</p>
          <p>All</p>
          <p>You can</p>
      </div>
      <div class="panel panel5">
          <p>Life</p>
          <p>In</p>
          <p>Silence</p>
      </div>
  </div>
</div>
body {
    font-family: Raleway, Helvetica, sans-serif;
    margin: 0;
  background-color: rgb(30, 26, 26);
}

#container {
  width: 940px;
  margin: 0 auto;
}

.panels {
    min-height: 100vh;
    overflow: hidden;
    display: flex;
}

.panel {
    color: #fff;
    text-align: center;
    align-items: center;
    flex: 1;
    justify-content: center;
    display: flex;
    flex-direction: column;
    font-size: 1em;
    transition: font-size 0.7s cubic-bezier(0.61, -0.19, 0.7, -0.11),
                flex 0.7s cubic-bezier(0.61, -0.19, 0.7, -0.11),
                background 0.2s;
}

.panel1 {
    background-image: url('https://s-media-cache-ak0.pinimg.com/originals/44/e4/74/44e474e2577c3ead3472d133f029d3bb.jpg');
    background-size: cover;
    background-repeat: no-repeat;
}

.panel2 {
    background-image: url('https://s-media-cache-ak0.pinimg.com/originals/44/e4/74/44e474e2577c3ead3472d133f029d3bb.jpg');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: 15%;
}

.panel3 {
    background-image: url('https://s-media-cache-ak0.pinimg.com/originals/44/e4/74/44e474e2577c3ead3472d133f029d3bb.jpg');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: 30%;
}

.panel4 {
    background-image: url('https://s-media-cache-ak0.pinimg.com/originals/44/e4/74/44e474e2577c3ead3472d133f029d3bb.jpg');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: 45%;
}

.panel5 {
    background-image: url('https://s-media-cache-ak0.pinimg.com/originals/44/e4/74/44e474e2577c3ead3472d133f029d3bb.jpg');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: 60%;
}

.panel > * {    /*  All children in a panel (p's)  */
    margin: 0;
    width: 100%;
    flex: 1 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: 0.5s;
}

.panel > :first-child {
    transform: translateY(-100%);
}

.panel > :last-child {
    transform: translateY(100%);
}

.panel.open-active > :first-child {
    transform: translateY(0);
}

.panel.open-active > :last-child {
    transform: translateY(0);
}

.panel > :nth-child(2) {
    font-size: 2.5em;
}

.panel.open {
    flex: 5;
    font-size: 30px;
}
const panels = document.querySelectorAll('.panel'); // get all panels

function toggleOpen() {
  this.classList.toggle('open');  // specific panel toggle class of open. Adds this class first
}

function toggleActive(e) {
  // console.log(e);
  console.log(e.propertyName);  
  if (e.propertyName.includes('flex')) {  // if panel is flexing
    this.classList.toggle('open-active'); // this panel toggle class open-active . Adds this class second
  }
}

panels.forEach(panel => panel.addEventListener('click', toggleOpen));   // listen for click event and run function
panels.forEach(panel => panel.addEventListener('transitionend', toggleActive)); // listen for tranistioned event and run function

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.