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.

            
              <div class="upload">
 <div class="upload-files">
  <header>
   <p>
    <i class="fa fa-cloud-upload" aria-hidden="true"></i>
    <span class="up">up</span>
    <span class="load">load</span>
   </p>
  </header>
  <div class="body" id="drop">
   <i class="fa fa-file-text-o pointer-none" aria-hidden="true"></i>
   <p class="pointer-none"><b>Drag and drop</b> files here <br /> or <a href="" id="triggerFile">browse</a> to begin the upload</p>
			<input type="file" multiple="multiple" />
  </div>
  <footer>
   <div class="divider">
    <span><AR>FILES</AR></span>
   </div>
   <div class="list-files">
    <!--   template   -->
   </div>
			<button class="importar">UPDATE FILES</button>
  </footer>
 </div>
</div>

            
          
!
            
              $skin: #4db6ac;

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}
body {
  font-family: 'Roboto', sans-serif;
  background: linear-gradient(to top, #4F6072, #8699AA);
  display: flex;
  justify-content: center;
  align-items: center;
}

//upload component
.upload {
  position: relative;
  width: 400px;
  min-height: 445px;
  box-sizing: border-box;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(black, .2);
  padding-bottom: 20px;
  background: #fff;
  animation: fadeup .5s .5s ease both;
  transform: translateY(20px);
  opacity: 0;
  .upload-files {
    header {
      background: $skin;
				  border-top-left-radius: 5px;
					 border-top-right-radius: 5px;
      text-align: center;
      p {
        color: #fff;
        font-size: 40px;
        margin: 0;
        padding: 50px 0;
        i {
          transform: translateY(20px);
          opacity: 0;
          font-size: 30px;
          animation: fadeup .5s 1s ease both;
        }
        .up {
          font-weight: bold;
          transform: translateX(-20px);
          display: inline-block;
          opacity: 0;
          animation: faderight .5s 1.5s ease both;
        }
        .load {
          display: inline-block;
          font-weight: 100;
          margin-left: -8px;
          transform: translateX(-20px);
          opacity: 0;
          animation: faderight 1s 1.5s ease both;
        }
      }
    }
    .body {
      text-align: center;
      padding: 50px 0;
      padding-bottom: 30px;
      &.hidden {
        display: none;
      }
      input {
        visibility: hidden;
      }
      i {
        font-size: 65px;
        color: lightgray;
      }
      p {
        font-size: 14px;
        padding-top: 15px;
        line-height: 1.4;
        b,
        a {
          color: $skin;
        }
      }
      &.active {
        border: dashed 2px $skin;
        i {
          box-shadow: 0 0 0 -3px #fff,
          0 0 0 lightgray,
          0 0 0 -3px #fff,
          0 0 0 lightgray;
          animation: file .5s ease both;
        }
        @keyframes file {
          50% {
            box-shadow: -8px 8px 0 -3px #fff,
            -8px 8px 0 lightgray,
            -8px 8px 0 -3px #fff,
            -8px 8px 0 lightgray;
          }
          75%,
          100% {
            box-shadow: -8px 8px 0 -3px #fff,
            -8px 8px 0 lightgray,
            -16px 16px 0 -3px #fff,
            -16px 16px 0 lightgray;
          }
        }
        .pointer-none{
          pointer-events: none;
        }
      }
    }
    footer {
      width: 100%;
      margin: 0 auto;
      height: 0;
      .divider {
        margin: 0 auto;
        width: 0;
        border-top: solid 4px darken($skin, 3.5%);
        text-align: center;
        overflow: hidden;
        transition: width .5s ease;
        span {
          display: inline-block;
          transform: translateY(-25px);
          font-size: 12px;
          padding-top: 8px;
        }
      }
      &.hasFiles {
        height: auto;
        .divider {
          width: 100%;
          span {
            transform: translateY(0);
            transition: transform .5s .5s ease;
          }
        }
      }
      .list-files {
        width: 320px;
        margin: 0 auto;
        margin-top: 15px;
        padding-left: 5px;
        text-align: center;
        overflow-x: hidden;
        overflow-y: auto;
        max-height: 210px;
        &::-webkit-scrollbar-track {
            background-color: rgba(lightgray, .25);
        }
        &::-webkit-scrollbar {
            width: 4px;
            background-color: rgba(lightgray, .25);
        }
        &::-webkit-scrollbar-thumb {
            background-color: rgba($skin, .5);
        }
        .file {
          width: 300px;
          min-height: 50px;
          display: flex;
          justify-content: space-between;
          align-items: center;
          opacity: 0;
          animation: fade .35s ease both;
          .name {
            font-size: 12px;
            white-space: nowrap;
            text-overflow: ellipsis;
            overflow: hidden;
            width: 80px;
            text-align: left;
          }
          .progress {
            width: 175px;
            height: 5px;
            border: solid 1px lightgray;
            border-radius: 2px;
            background: linear-gradient(to left, rgba($skin, .2), rgba($skin, .8)) no-repeat;
            background-size: 100% 100%;
            &.active {
              animation: progress 30s linear;
            }
          }

          @keyframes progress {
            from {
              background-size: 0 100%;
            }
            to {
              background-size: 100% 100%;
            }
          }

          .done {
            cursor: pointer;
            width: 40px;
            height: 40px;
            background: $skin;
            border-radius: 50%;
            margin-left: -10px;
            transform: scale(0);
            position: relative;
            &:before {
              content: "View";
              position: absolute;
              top: 0;
              left: -5px;
              font-size: 24px;
              opacity: 0;
            }
            &:hover:before {
              transition: all .25s ease;
              top: -30px;
              opacity: 1;
            }
            &.anim {
              animation: done1 .5s ease forwards;
              #path {
                animation: done2 2.5s .5s ease forwards;
              }
            }
            #path {
              stroke-dashoffset: 7387.59423828125;
              stroke-dasharray: 7387.59423828125 7387.59423828125;
              stroke: #fff;
              fill: transparent;
              stroke-width: 50px;
            }
          }
          @keyframes done2 {
            to {
              stroke-dashoffset: 0;
            }
          }
          @keyframes done1 {
            50% {
              transform: scale(.5);
              opacity: 1;
            }
            80% {
              transform: scale(.25);
              opacity: 1;
            }
            100% {
              transform: scale(.5);
              opacity: 1;
            }
          }
        }
      }
      .importar {
        outline: none;
        position: absolute;
        left: 0;
        right: 0;
        bottom: 20px;
        margin: auto;
        border: solid 1px $skin;
        color: $skin;
        background: transparent;
        padding: 8px 15px;
        font-size: 12px;
        border-radius: 4px;
        font-family: Roboto;
        line-height: 1;
        cursor: pointer;
        transform: translateY(15px);
        opacity: 0;
							 visibility: hidden;
        margin-left: calc(50% - 40px);
        &.active {
          transition: transform .5s 1.5s ease, opacity .5s 1.5s ease, background;
          transform: translateY(0);
          opacity: 1;
									 visibility: visible;
        }
        &:hover{
          background: $skin;
          color: #fff;
        }
      }
    }
  }
  @keyframes fadeup {
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
  @keyframes faderight {
    to {
      transform: translateX(0);
      opacity: 1;
    }
  }
  @keyframes fade {
    to {
      opacity: 1;
    }
  }
  @media (max-width: 400px){
    width: 100%;
    height: 100%;
  }
}

            
          
!
            
              //DOM
const $ = document.querySelector.bind(document);

//APP
let App = {};
App.init = (function() {
	//Init
	function handleFileSelect(evt) {
		const files = evt.target.files; // FileList object

		//files template
		let template = `${Object.keys(files)
			.map(file => `<div class="file file--${file}">
     <div class="name"><span>${files[file].name}</span></div>
     <div class="progress active"></div>
     <div class="done">
	<a href="" target="_blank">
      <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" viewBox="0 0 1000 1000">
		<g><path id="path" d="M500,10C229.4,10,10,229.4,10,500c0,270.6,219.4,490,490,490c270.6,0,490-219.4,490-490C990,229.4,770.6,10,500,10z M500,967.7C241.7,967.7,32.3,758.3,32.3,500C32.3,241.7,241.7,32.3,500,32.3c258.3,0,467.7,209.4,467.7,467.7C967.7,758.3,758.3,967.7,500,967.7z M748.4,325L448,623.1L301.6,477.9c-4.4-4.3-11.4-4.3-15.8,0c-4.4,4.3-4.4,11.3,0,15.6l151.2,150c0.5,1.3,1.4,2.6,2.5,3.7c4.4,4.3,11.4,4.3,15.8,0l308.9-306.5c4.4-4.3,4.4-11.3,0-15.6C759.8,320.7,752.7,320.7,748.4,325z"</g>
		</svg>
						</a>
     </div>
    </div>`)
			.join("")}`;

		$("#drop").classList.add("hidden");
		$("footer").classList.add("hasFiles");
		$(".importar").classList.add("active");
		setTimeout(() => {
			$(".list-files").innerHTML = template;
		}, 1000);

		Object.keys(files).forEach(file => {
			let load = 2000 + (file * 2000); // fake load
			setTimeout(() => {
				$(`.file--${file}`).querySelector(".progress").classList.remove("active");
				$(`.file--${file}`).querySelector(".done").classList.add("anim");
			}, load);
		});
	}

	// trigger input
	$("#triggerFile").addEventListener("click", evt => {
		evt.preventDefault();
		$("input[type=file]").click();
	});

	// drop events
	$("#drop").ondragleave = evt => {
		$("#drop").classList.remove("active");
		evt.preventDefault();
	};
	$("#drop").ondragover = $("#drop").ondragenter = evt => {
		$("#drop").classList.add("active");
		evt.preventDefault();
	};
	$("#drop").ondrop = evt => {
		$("input[type=file]").files = evt.dataTransfer.files;
		$("footer").classList.add("hasFiles");
		$("#drop").classList.remove("active");
		evt.preventDefault();
	};

	//upload more
	$(".importar").addEventListener("click", () => {
		$(".list-files").innerHTML = "";
		$("footer").classList.remove("hasFiles");
		$(".importar").classList.remove("active");
		setTimeout(() => {
			$("#drop").classList.remove("hidden");
		}, 500);
	});

	// input change
	$("input[type=file]").addEventListener("change", handleFileSelect);
})();

            
          
!
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