Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

            
              <div class="slider heart">
    <div class="ui-slider-handle heart">
      <svg viewBox="0 0 54 47" version="1.1">
      <defs>
      <clipPath  class="heartSin">
        <path d="M37.2249 4.00001C31.6841 4.00002 26.9911 9.44788 26.9911 9.44788C26.9911 9.44788 23.2279 3.99999 17.1264 4C10.3077 4.00001 6.00019 9.10739 6 15.5767C5.99965 27.4696 26.9956 39 26.9956 39C26.9956 39 47.6322 28.5155 47.9911 15.5768C48.2091 7.7186 44.4039 4 37.2249 4.00001Z"/> 
      </clipPath>
      </defs>        
  <path  d="M37.2249 4.00001C31.6841 4.00002 26.9911 9.44788 26.9911 9.44788C26.9911 9.44788 23.2279 3.99999 17.1264 4C10.3077 4.00001 6.00019 9.10739 6 15.5767C5.99965 27.4696 26.9956 39 26.9956 39C26.9956 39 47.6322 28.5155 47.9911 15.5768C48.2091 7.7186 44.4039 4 37.2249 4.00001Z" fill="#FFFFFF"/>  
<path class="anim" clip-path="url(#heart)" d="M0 50
             C   4 1,  6 1,  10 5 
             C  14 9, 16 9,  20 5
             C  24 1, 26 1,  30 5 
             C  34 9, 36 9,  40 5
             C  44 1, 46 1,  50 5
             C  54 9, 56 9,  60 5
             C  64 1, 66 1,  70 5
             C  74 9, 76 9,  80 5
             C  84 1, 86 1,  90 5
             C  94 9, 96 9, 100 5
             C 104 1, 106 1, 110 5
             L 110 40 L 0 40 Z" fill="#58CFEF"/>   
     
      </svg>
    </div>
    <div class="text">
        <span>Heart</span>
        <strong>-</strong>
    </div>
</div>


<div class="slider heart">
    <div class="ui-slider-handle heart">
      <svg viewBox="0 0 54 47" version="1.1">
      <defs>
      <clipPath class="heartSin">
        <path d="M37.2249 4.00001C31.6841 4.00002 26.9911 9.44788 26.9911 9.44788C26.9911 9.44788 23.2279 3.99999 17.1264 4C10.3077 4.00001 6.00019 9.10739 6 15.5767C5.99965 27.4696 26.9956 39 26.9956 39C26.9956 39 47.6322 28.5155 47.9911 15.5768C48.2091 7.7186 44.4039 4 37.2249 4.00001Z"/> 
      </clipPath>
      </defs>        
  <path  d="M37.2249 4.00001C31.6841 4.00002 26.9911 9.44788 26.9911 9.44788C26.9911 9.44788 23.2279 3.99999 17.1264 4C10.3077 4.00001 6.00019 9.10739 6 15.5767C5.99965 27.4696 26.9956 39 26.9956 39C26.9956 39 47.6322 28.5155 47.9911 15.5768C48.2091 7.7186 44.4039 4 37.2249 4.00001Z" fill="#FFFFFF"/>  
<path class="anim"  d="M0 50
             C   4 1,  6 1,  10 5 
             C  14 9, 16 9,  20 5
             C  24 1, 26 1,  30 5 
             C  34 9, 36 9,  40 5
             C  44 1, 46 1,  50 5
             C  54 9, 56 9,  60 5
             C  64 1, 66 1,  70 5
             C  74 9, 76 9,  80 5
             C  84 1, 86 1,  90 5
             C  94 9, 96 9, 100 5
             C 104 1, 106 1, 110 5
             L 110 40 L 0 40 Z" fill="#58CFEF"/>   
     
      </svg>
    </div>
    <div class="text">
        <span>Heart</span>
        <strong>-</strong>
    </div>
</div>

            
          
!

CSS

            
              $range: #58CFEF;
$rangeBG: rgba(#000, .2);
$smiley: #000;

.slider {
    width: 320px;
  margin-left: 50px;
    height: 2px;
    background: $rangeBG;
    border-radius: 2px;
    position: relative;
    .ui-slider-range {
        border-radius: 2px;
        background: $range;
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
    }
    .ui-slider-handle {
        cursor: move;
        cursor: grab;
        cursor: -moz-grab;
        cursor: -webkit-grab;
        width: 35px;
        height: 35px;
        position: absolute;
        outline: none;
        top: 0;
        
        transition: box-shadow .3s ease;
        opacity: 1;
        transform: translate(-50%, -12px); 
       svg {fill: #FFF}
      &.heart {
              svg {
                //width: 15px;
                //height: 7px;
                position: absolute;
                left: 50%;
                bottom: 0px;
                margin: 0 0 0 -10px;
                path {
                    stroke-width: 2;
                    stroke: #58CFEF;
                    //fill: none;
                    stroke-linecap: round;
                  .anim {
                    z-index: -1
                  }
                }
            }   
      }
  
        &.ui-state-active {
            cursor: grabbing;
            cursor: -moz-grabbing;
            cursor: -webkit-grabbing;
          &.balls { 
            margin: -18px 0 0 -18px;
            animation: spinAround 2s linear infinite;}
        }
    }
    .text {
        position: absolute;
        bottom: 100%;
        left: 0;
        right: 0;
        display: flex;
        justify-content: space-between;
        font-size: 16px;
        transform: translate(0, -80px);
        transition: transform .3s ease 0s;      
        strong {
            color: #000;
            font-weight: bold;
        }
    }
}

html {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

* {
    box-sizing: inherit;
    &:before,
    &:after {
        box-sizing: inherit;
    }
}
@keyframes spinAround {
	from {
		transform: rotate(0deg)
	}
	to {
		transform: rotate(360deg);
	}
}
// Center & dribbble
body {
    min-height: 100vh;
    font-family: Roboto, Arial;
    color: #ADAFB6;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
}
            
          
!

JS

            
              var step = 100;

$(".slider.heart").each(function() {
    let id = 'heart_' + Math.random().toString(36).substring(2);
    var self = $(this);
    var slider = self.slider({
        create: function() {
            self.find('.text strong').text(self.slider('value'));
            self.find('.heartSin').attr('id', id)
            self.find('svg path.anim').attr('clip-path', "url(#"+id+")")
            heart(self.find('svg path.anim'), self.slider('value'));
        },
        slide: function(event, ui) {
            self.find('.text strong').text(ui.value);
            heart(self.find('.heart').find('svg path.anim'), ui.value);
        },
        range: 'min',
        min: 1,
        max: step,
        value: 1,
        step: 1
    });
});


function heart(path, value) {
 path.attr('transform', `translate(${Math.sin(value/10)*10-15},${30-value/3})`)   
 path.closest('.slider').find('.heartSin').attr('transform', `translate(${15-Math.sin(value/10)*10},${-30+value/3})`)   
}


            
          
!
999px

Console