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.

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="drop-zone">
 <div class="timer-bar">
  <div class="wrapper">
   <i class='success-icon ion-ios-checkmark-empty'></i>
   <p class='success-text'></p>
  </div>
 </div>
 <p class="timer-info">Drop your file here</p>
</div>
              
            
!

CSS

              
                // helper
html
  box-sizing: border-box
  font-size: 62.5%

*
  padding: 0
  margin: 0
  -webkit-font-smoothing: antialiased
  -moz-osx-font-smoothing: grayscale
  box-sizing: inherit
  &::after, &::before
    box-sizing: inherit

%center
  position: absolute
  top: 50%
  left: 50%
  transform: translate(-50%, -50%)

=size($w, $h)
  width: $w
  height: $h

=font-size($sizeValue: 1.6)
  font-size: ($sizeValue * 10) + px
  font-size: $sizeValue + rem

$text-font: "Titillium Web", Arial, sans-serif
$white: #ecf0f1
$green-dark: #24a35a
$green: #2ecc71
$green-light: #57d68d
$black-grey: #555

body
  background-color: $green-dark

p
  font-weight: 600
  font-family: $text-font
  -webkit-font-smoothing: antialiased
  -moz-osx-font-smoothing: grayscale
  color: $white
  @media screen and (max-width: 599px)
    +font-size(2)
  @media screen and (min-width: 600px)
    +font-size(2.4)
  @media screen and (min-width: 990px)
    +font-size(2.7)
  @media screen and (min-width: 1200px)
    +font-size(3)

.drop-zone
  transition: height .25s, background-color .6s, border .25s
  @extend %center
  border: 3px dashed $white
  border-radius: 10px
  background-color: transparent
  +size(80%, 200px)
  @media screen and (max-width: 599px)
    max-width: 200px
    max-height: 200px
  @media screen and (min-width: 600px)
    max-width: 260px
    max-height: 260px
  @media screen and (min-width: 990px)
    max-width: 320px
    max-height: 320px
  @media screen and (min-width: 1200px)
    max-width: 480px
    max-height: 480px
  p
    text-align: center
    &.timer-info
      margin-top: 12px
  [class^="success-"]
    @extend %center
    opacity: 0
    color: $green-dark
			
.timer-bar-wrapper
  @extend %center
  border-radius: 4px
  box-shadow: 0 5px 11px 0 rgba(0, 0, 0, 0.18), 0 4px 15px 0 rgba(0, 0, 0, 0.15)
  +size(80%, 10px)
  background-color: $black-grey
  .timer-bar,
  .timer-info
    position: absolute
    left: 0
  .timer-bar
    top: 0
    +size(0, inherit)
    background-color: $white
    border-radius: inherit
  .timer-info
    font-weight: 400
    margin-left: -15px
  .wrapper
    overflow: hidden
    .success-text
      font-weight: 600
    @media screen and (max-width: 599px)
      .success-icon
        +font-size(18)
      .success-text
        display: none !important
    @media screen and (min-width: 600px)
      .success-icon
        top: calc(50% - 20px)
        +font-size(18)
      .success-text
        top: calc(50% + 25px)
        +font-size(2.2)
    @media screen and (min-width: 990px)
      .success-icon
        top: calc(50% - 25px)
        +font-size(24)
      .success-text
        top: calc(50% + 28px)
        +font-size(2.8)
    @media screen and (min-width: 1200px)
      .success-icon
        top: calc(50% - 38px)
        +font-size(30)
      .success-text
        top: calc(50% + 42px)
        +font-size(4.2)

.expand
  transition: height 0.35s 0.25s ease-in, border-radius 0.35s 0.35s ease-out
  border-radius: 50%

.up
  opacity: 1
  animation: bounceInUp 0.6s

@keyframes bounceInUp
  from, 60%, 75%, 90%, to
    animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1)
  from
    transform: translate(-50%, calc(-50% + 100px))
  35%
    opacity: 0
  70%
    opacity: 1
    transform: translate(-50%, calc(-50% - 40px))
  80%
    transform: translate(-50%, calc(-50% - 35px))
  to
    opacity: 1
              
            
!

JS

              
                $(function () {

    var totalTime = 6, // seconds
        percent = 0,
        $sIcon = $('.success-icon'),
        $sText = $('.success-text'),
        $info = $('.timer-info'),
        $bar = $('.timer-bar'),
        $dropZone = $('.drop-zone'),
        dropZone = $('.drop-zone')[0],
        width = $dropZone.width(),
        countdown,
        countdownOver = false;

    var startCountdown = function () {
        $dropZone.css('border', 'none');
        $dropZone.addClass('timer-bar-wrapper');
        $info.text('0%');
        countdown = setInterval(updateBar, 25);
    };

    $(window).resize(function () {
        if (countdownOver) {
            width = $dropZone.width();
            $dropZone.css('height', width);
        }
    });

    var fileStatus = function () {
        $sIcon
            .addClass('up')
            .delay(250)
            .fadeTo(250, 1, 'swing');
        $sText
            .text('File uploaded')
            .delay(500)
            .fadeTo(350, 1, 'swing');
        $dropZone.css('transition', 'none');
    };

    var triggerFinish = function () {
        $dropZone
            .css('height', width)
            .addClass('expand');
        $info.fadeTo(250, 0, 'swing');
        setTimeout(fileStatus, 700);
    };

    var stopCountdown = function () {
        clearInterval(countdown);
        $('.timer-info').text('100%');
        triggerFinish();
    };

    var updateBar = function () {
        percent++;
        // /40, because it's called every 25ms
        // -> 25ms * 40 = 1 sec
        var per = (100 * percent / totalTime) / 40;
        $bar.css('width', per + '%');
        $info
            .css('left', per + '%')
            .text(per.toFixed(1) + '%');
        if (per >= 100) {
            stopCountdown();
            countdownOver = true;
        }
    };

    dropZone.addEventListener('dragover', function (e) {
        e.stopPropagation();
        e.preventDefault();
    });
    dropZone.addEventListener('drop', function (e) {
        e.stopPropagation();
        e.preventDefault();
        setTimeout(startCountdown, 250)
    });
});

              
            
!
999px

Console