Skip to content

Commit cc17f1d

Browse files
committed
Added callback example + new minified version
1 parent d0e485a commit cc17f1d

File tree

4 files changed

+37
-5
lines changed

4 files changed

+37
-5
lines changed

assets/css/application.css

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,20 @@ hr {
5151
border-bottom: 1px solid #bdc3c7;
5252
margin: 30px 0; }
5353

54-
#image-preview {
54+
#image-preview, #callback-preview {
5555
width: 400px;
5656
height: 400px;
5757
position: relative;
5858
overflow: hidden;
5959
background-color: #ffffff;
6060
color: #ecf0f1; }
61-
#image-preview input {
61+
#image-preview input, #callback-preview input {
6262
line-height: 200px;
6363
font-size: 200px;
6464
position: absolute;
6565
opacity: 0;
6666
z-index: 10; }
67-
#image-preview label {
67+
#image-preview label, #callback-preview label {
6868
position: absolute;
6969
z-index: 5;
7070
opacity: 0.8;

assets/css/application.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ hr {
6161
margin: 30px 0;
6262
}
6363

64-
#image-preview {
64+
#image-preview, #callback-preview {
6565
width: 400px;
6666
height: 400px;
6767
position: relative;

assets/js/jquery.uploadPreview.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

+32
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@
1818
preview_box: "#audio-preview",
1919
no_label: true
2020
});
21+
22+
$.uploadPreview({
23+
input_field: "#callback-upload",
24+
preview_box: "#callback-preview",
25+
label_field: "#callback-label",
26+
success_callback: function() {
27+
alert("File will now be previewed");
28+
}
29+
});
2130
});
2231
</script>
2332
<link rel="stylesheet" href="assets/css/application.css" type="text/css" />
@@ -144,6 +153,29 @@ <h2>Image File Example</h2>
144153

145154
<hr />
146155

156+
<h2>Callback Example</h2>
157+
<pre>
158+
&lt;script type="text/javascript"&gt;
159+
$(document).ready(function() {
160+
$.uploadPreview({
161+
input_field: "#callback-upload",
162+
preview_box: "#callback-preview",
163+
label_field: "#callback-label",
164+
success_callback: function() {
165+
alert("File will now be previewed");
166+
}
167+
});
168+
});
169+
&lt;/script&gt;
170+
</pre>
171+
172+
<div id="callback-preview">
173+
<label for="callback-upload" id="callback-label">Choose File</label>
174+
<input type="file" name="image" id="callback-upload" />
175+
</div>
176+
177+
<hr />
178+
147179
<h2>Audio File Example</h2>
148180
<pre>
149181
&lt;style type="text/css"&gt;

0 commit comments

Comments
 (0)