123

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

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.

            
              .player
  .info
    .menu-row
      .btn.menu.left
        i.fa.fa-bars
      .btn.options.right
        i.fa.fa-ellipsis-v
      .btn.heart.right
        i.fa.fa-heart
    .song Feel So Close - Radio Edit
    .artist Calvin Harris
    .time 3:26
  .controls
    .playback
      .previous
        i.fa.fa-step-backward
      button.pause
        i.fa.fa-pause
      .next
        i.fa.fa-step-forward
    .volume
      button.vol-down
        i.fa.fa-volume-down
      .vol-bar
        .level
      button.vol-up
        i.fa.fa-volume-up
    .playlist
      i.fa.fa-bars
    .shuffle
      i.fa.fa-random
  .track
    .complete
            
          
!
            
              @import "bourbon";

html,
body {
  position: relative;
  width: 100%;
  height: 100%;
}
body {
  background-color: rgba(178, 144, 158, 0.5);
}
.player {
  margin: auto;
  @include position(absolute, 0 0 0 0);
  width: 500px;
  height: 320px;
  background-color: #fff;

  background-image: url(https://i.imgur.com/ybyFZ4V.jpg);
  background-position: center 0;
  background-repeat: no-repeat;

  border-radius: 5px;
  box-shadow: 0 0 8px -1px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}
.info {
  position: relative;
  width: 100%;
  height: 200px;
  background-color: rgba(255, 51, 51, 0.35);
  overflow: hidden;

  .menu-row {
    margin-top: 12px;
    width: 100%;
    height: 40px;
    z-index: 15;
    .btn {
      width: 40px;
      height: 40px;
      font-size: 20px;
      line-height: 40px;
      text-align: center;
      &.menu, &.options {
        color: #fff;
      }
      &.heart {
        color: rgba(230, 230, 230, 0.5);
        &:hover {
          color: #fff;
        }
      }
      i {
        cursor: pointer;
      }
      &.left {
        margin-left: 5px;
        float: left;
      }
      &.right {
        margin-right: 5px;
        float: right;
      }
    }
  }

  .song, .artist {
    font: {
      weight: 300;
    }
    color: #fff;
  }

  .song {
    @include position(absolute, null null 45px 16px);
    font-size: 22px;
  }
  .artist {
    @include position(absolute, null null 30px 16px);
    font-size: 14px;
  }

  .time {
    @include position(absolute, null null 10px 16px);
    font: {
      weight: 300;
      size: 12px;
    }
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
  }
}

.controls {
  position: relative;
  width: 100%;
  height: 116px;

  .playback {
    @include position(absolute, null null 20px 15px);
    width: 180px;
    height: 60px;

    .previous,
    .pause,
    .next {
      border-radius: 50%;
      background-color: #f2f2f2;
      text-align: center;
      color: #111;
      cursor: pointer;
      
      -webkit-appearance: none;
      border: none;
      outline: none;
    }

    .previous,
    .next {
      position: absolute;
      top: 15px;
      width: 30px;
      height: 30px;
      font-size: 14px;
      line-height: 30px;

    }

    .previous {
      left: 30px;
    }

    .next {
      right: 30px;
    }

    .pause {
      margin: auto;
      @include position(absolute, 0 0 0 0);
      width: 44px;
      height: 44px;
      font-size: 18px;
      line-height: 42px;
      .fa-play {
        text-indent: 2px;
      }
    }
  }

  .volume {
    @include position(absolute, null null 20px 200px);
    width: 180px;
    height: 60px;

    .vol-down,
    .vol-up {
      position: absolute;
      width: 30px;
      height: 20px;
      top: 20px;
      font-size: 18px;
      line-height: 20px;
      text-align: center;
      color: #111;
      
      -webkit-appearance: none;
      background: none;
      outline: none;
      border: none;
    }

    .vol-down {
      left: 5px;
    }

    .vol-up {
      right: 5px;
    }

    .vol-bar {
      margin: auto;
      @include position(absolute, 0 0 0 0);
      width: 110px;
      height: 4px;
      background-color: #f2f2f2;
      border-top: 3px solid #fff;
      border-bottom: 3px solid #fff;
      cursor: pointer;
      @include transition(all 0.1s ease-in-out);
      &:hover {
        height: 12px;
      }
      .level {
        width: 75%;
        height: 100%;
        background-color: #111;
      }
    }
  }

  .playlist {
    @include position(absolute, null 33px 50px null);
    width: 30px;
    height: 30px;

    font-size: 14px;
    line-height: 62px;
    text-align: center;
    color: #111;
    cursor: pointer;
  }

  .shuffle {
    @include position(absolute, -30px 18px null null);
    width: 60px;
    height: 60px;
    background-color: #f50057;
    border-radius: 50%;
    box-shadow: 0 0 6px 1px rgba(0, 0, 0, 0.25);
    font-size: 22px;
    line-height: 62px;
    text-align: center;
    color: #fff;
    z-index: 50;
    cursor: pointer;
  }
}

.track {
  width: 100%;
  height: 4px;
  .complete {
    width: 60%;
    height: 100%;
    background-color: #f1206a;  
  }
}
            
          
!
            
              var track = new Ticker({
  element: '.complete',
  start: 60,
  time: 526
});

$('.pause').on('click', function () {
  $(this).children('.fa')
    .toggleClass('fa-pause')
    .toggleClass('fa-play');
  
  if (track.paused) {
    track.play();
  } else {
    track.pause();
  }
});

$('.vol-down, .vol-up').on('click', function () {
  var change,
      pos = $('.level').width(),
      width = $('.vol-bar').width();
  
  if ($(this).hasClass('vol-down')) {
    change = -10;
  } else if ($(this).hasClass('vol-up')) {
    change = 10;
  }
  
  if (pos + change < 0) {
    $('.level').width(0);
  } else if (pos + change > width) {
    $('.level').width(width);
  } else {
    $('.level').width(pos + change);
  }
});

$('.vol-bar').on('click', function (event) {
  $('.level').width(event.offsetX);
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console