cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

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.

            
              <div class="container">
  <div class="card-carousel">
    <header>
      <span id="pagination-count" class="pagination-count">25 of 56</span>
      <span class="view"></span>
      <span id="heart" class="heart"></span>
    </header>
    <div id="twentyfive" class="content-wrapper twentyfive">
      <div class="content">
        <p class="quote">Details matter, it's worth waiting to get it right.</p>
        <name class="author">- Steve Jobs</name>
      </div>
    </div>
    <div id="twentysix" class="content-wrapper twentysix">
      <div class="content">
        <p class="quote">He not busy being born is busy dying.</p>
        <name class="author">- Bob Dylan</name>
      </div>
    </div>
  </div>
  <span id="hearted" class="hearted"></span>
  <div class="pagination">
    <span id="prev" class="prev"></span>
    <span id="next" class="next"></span>
  </div>
  <div class="avatar">
    <img class="twentyfive" src="http://i102.photobucket.com/albums/m104/GovernorFancyPants/Codepen/steve_jobs_zpsb8899f6c.png" alt="" width="200" />
    <img src="http://i102.photobucket.com/albums/m104/GovernorFancyPants/Codepen/bob_dylan_zps13c80b3d.jpg" alt="" class="twentysix" />
  </div>
</div>
            
          
!
            
              @import "compass/css3";

body {
  font-family: helvetica, arial, sans-serif;
  font-size: 1rem;
  line-height: 1.4;
  background-color: #ECF0F1;
  color: #fff;
  font-weight: 100;
}
*, *:before, *:after {
  -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
}
@import url(//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css);
@mixin icon {
  font-family: FontAwesome;
  font-size: 16px;
  line-height: 16px;
  position: absolute;
  top: 8px;
  left: 6px;
}

//Variables
$color-icon-alternate: rgba(255,255,255,.2);

.container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translateX(-50%) translateY(-50%);
  box-shadow: 0 0 10px 2px rgba(0,0,0,.2);
  border-radius: 8px;
}
.card-carousel {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background-color: #2c3e50;
  width: 21rem;
  height: 27rem;
  box-shadow: 0 30px 20px -10px rgba(0,0,0,0.15);
  &:before {
    content: "";
    position: absolute;
    bottom: 0;
    height: 8px;
    width: 100%;
    background-color: rgba(0,0,0,.84);
  }
  header {
    position: absolute;
    border-radius: 8px 8px 0 0;
    width: 100%;
    height: 3em;
    line-height: 3em;
    padding: 0 1em;
    background-color: rgba(155, 89, 182, 0.84);
    z-index: 10;
    .view, .heart {
      position: absolute;
      top: 8px;
      height: 2rem;
      width: 2rem;
      border: 2px solid $color-icon-alternate;
      border-radius: 100%;
      transition: border-color 0.2s ease;
      &:hover {
        cursor: pointer;
        border-color: #fff;
      }
    }
    .view {
      right: 3.5rem;
      &:before {
        content: "\f064";
        @include icon;
      }
    }
    .heart {
      right: 1rem;
      &:before {
        content: "\f004";
        @include icon;
      }
    }
  }
}
.content-wrapper {
  position: absolute;
  padding-top: 3rem;
  height: 100%;
  transition: transform 1s ease;
  &.twentyfive {
    &:before {
      background: url(http://i102.photobucket.com/albums/m104/GovernorFancyPants/Codepen/steve_jobs_zpsb8899f6c.png);
      background-size: cover;
    }
    .slide & {
      transform: translateX(-100%);
    }
  }
  &.twentysix {
    transform: translateX(100%);
    &:before {
      background: url(http://i102.photobucket.com/albums/m104/GovernorFancyPants/Codepen/bob_dylan_zps13c80b3d.jpg);
      background-size: cover;
    }
    .slide & {
      transform: translateX(0);
    }
  }
  &:before {
    content: "";
    position: absolute;
    opacity: 0.2;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    
  }
  .content {
    position: relative;
    padding: 3rem;
    text-align: center;
    .quote {
      position: relative;
      font-size: 2rem;
      line-height: 1.2;
      margin-bottom: .5rem;
      &:before {
        content: "\f10d";
        @include icon;
        color: $color-icon-alternate;
        font-size: 32px;
        top: -2rem;
        left: -1rem;
      }
    }
    name {
      line-height: 1.2;
    }
  }
}
.pagination {
  position: absolute;
  bottom: 0;
  height: 4em;
  width: 100%;
  padding: 1em;
  z-index: 10;
  .prev, .next {
    position: absolute;
    height: 2rem;
    width: 2rem;
    border: 2px solid $color-icon-alternate;
    border-radius: 100%;
    transition: border-color 0.2s ease;
    cursor: pointer;
    &:hover {
      border-color: #fff;
    }
    &:before {
      @include icon;
    }
  }
  .prev {
    left: 1rem;
    &:before {
      content: "\f0d9";
      top: 7px;
      left: 10px;
    }
  }
  .next {
    right: 1em;
    &:before {
      content: "\f0da";
      top: 7px;
      left: 13px;
    }
  }
}
.hearted {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translateX(-50%) translateY(-50%);
  width: 120px;
  height: 120px;
  .like &:before {
    content: "\f004";
    @include icon;
    font-size: 110px;
    line-height: 1;
    animation: heartbeat 1s linear 1 forwards;
    
  }
}
.avatar {
  position: absolute;
  width: 100%;
  bottom: -2rem;
  text-align: center;
  img {
    width: 100px;
    height: 100px;
    border: 4px solid #fff;
    border-radius: 100%;
    transition: opacity 2s ease;
    &.twentyfive {
      opacity: 1;
      .slide & {
        visibility: hidden;
        position: absolute;
        opacity: 0;
      }
    }
    &.twentysix {
      visibility: hidden;
      position: absolute;
      opacity: 0;
      .slide & {
        visibility: visible;
        position: static;
        opacity: 1;
      }
    }
  }
}

@keyframes heartbeat {
  /*0% { font-size: 32px; opacity: 0; }
  25% { font-size: 48px; opacity: 1; }
  50% { font-size: 32px; opacity: .5; }
  75% { font-size: 48px; opacity: 1; }
  100% { font-size: 32px; opacity: 0; }*/
  0% { transform: scale(0,0); opacity: 0; }
  40% { transform: scale(1,1); opacity: 1; }
  50% { transform: scale(.8,.8); opacity: .5; }
  60% { transform: scale(1,1); opacity: 1; }
  100% { transform: scale(0,0); opacity: 0; }
}
            
          
!
            
              var pagPrev = document.getElementById("prev"),
    pagNext = document.getElementById("next"),
    pagCount = document.getElementById("pagination-count"),
    heart = document.getElementById("heart");

next.addEventListener("click", function() {
  slide();
}, false);
prev.addEventListener("click", function() {
  slide();
}, false);
heart.addEventListener("click", function() {
  document.body.className += " like";
  setTimeout( function() {
    document.body.className = "";
  }, 1000 );
}, false);

function slide() {
  if (document.body.classList.contains("slide")) {
    document.body.className = "";
    pagCount.textContent = "25 of 56"
  } else {
    document.body.className += " slide";
    pagCount.textContent = "26 of 56"
  }
}
            
          
!
999px
Loading ..................

Console