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

              
                <div class="options">
  <span class="reactions">
    <div class="icon-container">
      <span data-popup="Like" class="like reaction"></span>
    </div>
    <div class="icon-container">
      <span data-popup="Love"class="love reaction"></span>
    </div>
    <div class="icon-container">
      <span data-popup="Thankful"class="thankful reaction"></span>
    </div>
    <div class="icon-container">
      <span data-popup="Haha"class="haha reaction"></span>
    </div>
    <div class="icon-container">
      <span data-popup="Wow"class="wow reaction"></span>
    </div>
    <div class="icon-container">
      <span data-popup="Sad"class="sad reaction"></span>
    </div>
    <div class="icon-container">
      <span data-popup="Angry"class="angry reaction"></span>
    </div>
  </span>
  
  <span class="button">
    Like
  </span>
</div>
              
            
!

CSS

              
                body, html
  height: 100vh
  background: #e9eaed
  user-select: none

body
  display: flex
  align-items: center
  justify-content: center
    
  .options
    background: white
    width: 70px
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .08), 0 2px 2px rgba(0, 0, 0, .15)
    border-radius: 20px
    padding: 10px 13px
    font:
      size: 0
      family: Helvetica
      weight: bold
    color: #7f7f7f
    position: relative
    cursor: pointer
    text-align: center
    
    .button
      font-size: 12px
      vertical-align: middle
    
    &::before
      content: ''
      display: inline-block
      vertical-align: middle
      height: 16px
      width: 16px
      margin-right: 4px
      background:
        image: url(https://static.xx.fbcdn.net/rsrc.php/v3/y3/r/GLfzuZS5ZZ5.png)
        size: auto
        position: 0 -892px
    
      .reactions
        opacity: 1
        transition: .1s .5s

    .reactions
      .icon-container
        &:hover
          transform: scale(1.3, 1.3) translateY(-5px)
            
    &:hover
      .reactions
        opacity: 1
    
    &.default
      color: #7f7f7f !important
      
      &::before
        background:
          position: 0 -893px
          
    &.Like
      color: rgb(88, 144, 255)
      
      &::before
        background:
          position: 0 -922px
    
    &.Love
      &::before
        background:
          position: 0 -710px
    
    &.Thankful
      &::before
        background:
          position: 0 -642px
        
    &.Haha
      &::before
        background:
          position: 0 -676px
        
    &.Wow
      &::before
        background:
          position: 0 -795px
        
    &.Sad
      &::before
        background:
          position: 0 -744px
        
    &.Angry
      &::before
        background:
          position: 0 -608px

    .reactions
      position: absolute
      bottom: 130%
      left: 50%
      transform: translateX(-50%)
      border-radius: 50px
      background: white
      box-shadow: 0 0 0 1px rgba(0, 0, 0, .08), 0 2px 2px rgba(0, 0, 0, .15)
      line-height: 0
      white-space: nowrap
      opacity: 0
      padding: 3px
      pointer-events: none
      transition: .2s .5s
      
      .icon-container
        display: inline-block
        transition: transform .2s ease

      .reaction
        display: inline-block
        height: 48px
        width: 48px
        transform: perspective(1px) scale(.8, .8) translate(0, 0)
        transition: transform 0s .7s ease, opacity 0s .7s ease
        line-height: initial
        opacity: 0
        border-radius: 100%
        background:
          image: url(https://assets.medinnna.com/facebook-reactions.gif)
          repeat: no-repeat
          size: auto
        
        &.is-visible
          transition: opacity .3s ease
          opacity: 1
          pointer-events: all
          animation: testes .6s ease forwards
          
          @keyframes testes
            0%
              transform: perspective(1px) scale(.8, .8) translate(0, 70px)
            30%
              transform: perspective(1px) scale(.87, .87) translate(0, -4px)
            70%
              transform: perspective(1px) scale(.8, .8) translate(0, 1px)
            100%
              transform: perspective(1px) scale(.8, .8) translate(0, 0)
          
          &:hover
            transform: perspective(1px) scale(1, 1) translate(0, -5px)

            &::after
              opacity: 1

        &::after
          content: attr(data-popup)
          position: absolute
          background: rgba(0, 0, 0, .7)
          border-radius: 15px
          color: white
          font:
            family: helvetica
            weight: bold
            size: 13px
          padding: 2px 7px
          top: -25px
          left: 50%
          transform: translateX(-50%)
          white-space: nowrap
          opacity: 0
          transition: opacity .07s ease

        &.like
          background:
            position: 0 0

        &.love
          background:
            position: -52px 0
        
        &.thankful
          background:
            position: -314px 0

        &.haha
          background:
            position: -104px 0

        &.wow
          background:
            position: -156px 0

        &.sad
          background:
            position: -208px 0

        &.angry
          background:
            position: -260px 0
              
            
!

JS

              
                var animateReactionsOn;
var animateReactionsOut;

$(function () {
  $(".options").mouseenter(function () {
    var parent = $(this)
    
    animateReactionsOn = setTimeout(function () {      
      parent.find(".reaction").each(function (index) {
        var element = $(this)
        setTimeout(function () {
          element.addClass("is-visible");
        }, index * 60);
      });
    }, 500);
    
    clearTimeout(animateReactionsOut);
  });
  
  $(".options").mouseleave(function () {
    var parent = $(this)
    
    animateReactionsOut = setTimeout(function () {
      parent.removeClass("active");
      parent.find(".reaction").removeClass("is-visible");
    }, 500);
    
    clearTimeout(animateReactionsOn);
  });
  
  
  
  
  
  
  
  
  
  var dataPopupOld = null;
  var dataPopupNew = null;
  
  
  $(".options .button").click(function () {
    var children = $(this)
    var parent = $(this).parent()
    
    if ($(this).parent().is(".Like, .Love, .Thankful, .Haha, .Wow, .Sad, .Angry")) {
      parent.removeClass("Like Love Thankful Haha Wow Sad Angry");
      parent.addClass("default");
      parent.find(".button").text("Like");
    } else {
      parent.addClass("Like");
    }
    
    if ($(this).parent().hasClass("default")) {
      $(this).addClass("Like");
    }
  });
  
  
  $(".reaction").click(function () {
    dataPopupNew = $(this).attr("data-popup");
    
    $(".options").removeClass("default");
    
    $(".options .button").text(dataPopupNew);
    
    $('.options:contains(Like)').css('color', 'rgb(88, 144, 255)');
    $('.options:contains(Love)').css('color', 'rgb(242, 82, 104)');
    $('.options:contains(Thankful)').css('color', 'rgb(157, 135, 210)');
    $('.options:contains(Haha), .options:contains(Wow), .options:contains(Sad)').css('color', 'rgb(240, 186, 21)');
    $('.options:contains(Angry)').css('color', 'rgb(247, 113, 75)');
    
    $(".options").removeClass(dataPopupOld);
    $(".options").addClass(dataPopupNew);
    
    dataPopupOld = dataPopupNew
  });
});
              
            
!
999px

Console