-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
170 lines (170 loc) · 3.2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>html5 断点续传</title>
<style type="text/css">
*{
margin: 0;
padding: 0;
}
.wrap{
width: 800px;
margin: 20px auto;
font-size: 13px;
font-family: 'Lucida Grande',Verdana;
}
#file-btn{
color: #fff;
background-color: #428bca;
border-color: #357ebd;
display: inline-block;
padding: 10px;
border-radius: 4px;
position: relative;
cursor: pointer;
-webkit-box-shadow: inset 0 -4px 0 #2a6496;
box-shadow: inset 0 -4px 0 #2a6496;
border: 0;
text-decoration: none
}
#file-btn input{
opacity: 0;
width: 62px;
height: 26px;
position: absolute;
cursor: pointer;
top:0;
left:0;
}
.file-list{
display: table;
width: 100%;
margin-top: 20px;
border: 1px solid #ccc
}
.file-list a{
text-decoration: none;
color: #0095C1
}
.upload-list{
display: table-row;
}
.upload-list span{
border-top: 1px solid #eee;
}
.file-list .th{
display: table-row;
background: #f5f5f5;
}
.file-list .th span{
color: #999
}
.upload-name{
width: 25%;
}
.upload-progress{
width: 25%;
}
.upload-progress strong{
display: block;
height: 6px;
line-height: 0;
background: #DBE1E9
}
.upload-size{
min-width: 140px;
}
.upload-size i{
font-style: normal;
}
.upload-progress i{
display: block;
width: 0;
height: 6px;
line-height: 0;
background: #3482da;
-webkit-transition:.5s width ease;
-moz-transition:.5s width ease;
-o-transition:.5s width ease;
-ms-transition:.5s width ease;
transition:.5s width ease;
}
.file-list span{
padding: 10px 5px;
display: table-cell;
border-right: 1px solid #eee;
color: #333
}
.file-list span:last-child{
border-right: 0 none;
}
#submit, #pause{
color: #fff;
background-color: #428bca;
border-color: #357ebd;
display: inline-block;
padding: 5px;
border-radius: 3px;
position: relative;
cursor: pointer;
-webkit-box-shadow: inset 0 -3px 0 #2a6496;
box-shadow: inset 0 -3px 0 #2a6496;
border: 0;
margin-top: 10px;
text-decoration: none
}
#addfile{
margin: 10px 0;
padding: 20px;
width: 30%;
color: #666;
border: 1px dashed #777;
}
.into{
box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5) inset;
}
</style>
</head>
<body>
<div class="wrap">
<!--<span id="file-btn">选择文件</span>-->
<div id="addfile">请将文件拖入</div>
<div class="file-list">
<div class="upload-list th">
<span>文件名</span>
<span>上传进度</span>
<span>文件大小</span>
<span>文件类型</span>
<span>状态</span>
<span>操作</span>
</div>
</div>
<a href="javascript:;" id="submit">上传</a>
<a href="javascript:;" id="pause">暂停</a>
</div>
<script type="text/javascript" src="upload.js"></script>
<script type="text/javascript">
var $ = function(str){
return document.querySelector(str);
}
var up = upload({
listParent: $('.file-list'),
//selectBtn: $('#file-btn'),
dragElement: $('#addfile'),
listItem: 'name|progress|size|type|state|remove',
fileName: 'file',
fileSplitSize: 1024 * 1024 * 2,
fileMax: 999999999,
uploader: 'upload.php',
types: '*'
});
$('#submit').onclick = function(){
up.upload();
}
$('#pause').onclick = function(){
up.pause();
}
</script>
</body>
</html>