JSFiddle - React, Tailwind, and code Playground
by taufan
HTML
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://dl.dropbox.com/u/1559658/dropzone/dropzone.js"></script>
<div ng-app="dropZone" ng-controller="dropZoneCtrl">
<form action="/upload"
class="dropzone"
drop-zone
id="file-dropzone">
</form>
</div>
CSS
.dropzone,
.dropzone * {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.dropzone {
position: relative;
min-height: 260px;
border: 2px dashed rgba(0,0,0,0.3);
-webkit-border-radius: 4px;
border-radius: 4px;
background: rgba(0,0,0,0.03);
padding: 23px;
}
.dropzone.drag-hover {
border-color: rgba(0,0,0,0.15);
background: rgba(0,0,0,0.04);
}
.dropzone.drag-hover .message {
opacity: 0.15;
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=15);
filter: alpha(opacity=15);
}
.dropzone.started .message {
opacity: 0;
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
filter: alpha(opacity=0);
}
.dropzone .message {
opacity: 1;
-ms-filter: none;
filter: none;
-webkit-transition: opacity 0.3s ease-in-out;
-moz-transition: opacity 0.3s ease-in-out;
-o-transition: opacity 0.3s ease-in-out;
-ms-transition: opacity 0.3s ease-in-out;
transition: opacity 0.3s ease-in-out;
background: url("http://dl.dropbox.com/u/1559658/dropzone/spritemap.png") no-repeat 0 -108px;
position: absolute;
width: 168px;
height: 157px;
margin-left: -84px;
margin-top: -78.5px;
top: 50%;
left: 50%;
}
.dropzone .message span {
display: none;
}
.dropzone.browser-not-supported {
padding: 30px;
}
.dropzone.browser-not-supported .message {
position: relative;
background: url("http://dl.dropbox.com/u/1559658/dropzone/spritemap.png") no-repeat 0 0;
width: 204px;
height: 108px;
top: 0;
left: 0;
margin-left: 0;
margin-top: 0;
margin-bottom: 20px;
}
.dropzone .preview {
width: 100px;
height: 136px;
display: inline-block;
margin: 18px;
position: relative;
}
.dropzone .preview .details {
width: 100px;
height: 100px;
position: relative;
}
.dropzone .preview .details img {
position: absolute;
top: 0;
left: 0;
width: 100px;
height: 100px;
}
.dropzone .preview .details .size {
color: #666;
font: 500 31px/31px "League Gothic", sans-serif;
...
JavaScript
angular.module('dropZone', [])
.directive('dropZone', function() {
return function(scope, element, attrs) {
element.dropzone({
url: "/upload",
maxFilesize: 100,
paramName: "uploadfile",
maxThumbnailFilesize: 5
});
}
});