Show More
@@ -1,27 +1,27 b'' | |||
|
1 | 1 | $('input[name=image]').wrap($('<div class="file_wrap"></div>')); |
|
2 | 2 | |
|
3 | 3 | $('body').on('change', 'input[name=image]', function(event) { |
|
4 | 4 | var file = event.target.files[0]; |
|
5 | 5 | |
|
6 | 6 | if(file.type.match('image.*')) { |
|
7 | 7 | var fileReader = new FileReader(); |
|
8 | 8 | |
|
9 | 9 | fileReader.addEventListener("load", function(event) { |
|
10 | 10 | var wrapper = $('.file_wrap'); |
|
11 | 11 | |
|
12 | 12 | wrapper.find('.file-thumb').remove(); |
|
13 | 13 | wrapper.append( |
|
14 | 14 | $('<div class="file-thumb" style="background-image: url('+event.target.result+')"></div>') |
|
15 | 15 | ); |
|
16 | 16 | }); |
|
17 | 17 | |
|
18 | 18 | fileReader.readAsDataURL(file); |
|
19 | 19 | } |
|
20 | 20 | }); |
|
21 | 21 | |
|
22 | 22 | var form = $('#form'); |
|
23 | 23 | $('textarea').keypress(function(event) { |
|
24 | if (event.which == 13) { | |
|
24 | if (event.which == 13 && event.ctrlKey) { | |
|
25 | 25 | form.submit(); |
|
26 | 26 | } |
|
27 | 27 | }); No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now