Show More
@@ -1,4 +1,6 b'' | |||||
1 | function addImgPreview() { |
|
1 | function addImgPreview() { | |
|
2 | var margin = 20; | |||
|
3 | ||||
2 | //keybind |
|
4 | //keybind | |
3 | $(document).on('keyup.removepic', function(e) { |
|
5 | $(document).on('keyup.removepic', function(e) { | |
4 | if(e.which === 27) { |
|
6 | if(e.which === 27) { | |
@@ -18,12 +20,12 b' function addImgPreview() {' | |||||
18 | var win_h = $(window).height(); |
|
20 | var win_h = $(window).height(); | |
19 | //new image size |
|
21 | //new image size | |
20 | if (img_w > win_w) { |
|
22 | if (img_w > win_w) { | |
21 | img_h = img_h * (win_w/img_w); |
|
23 | img_h = img_h * (win_w/img_w) - margin; | |
22 | img_w = win_w; |
|
24 | img_w = win_w - margin; | |
23 | } |
|
25 | } | |
24 | if (img_h > win_h) { |
|
26 | if (img_h > win_h) { | |
25 | img_w = img_w * (win_h/img_h); |
|
27 | img_w = img_w * (win_h/img_h) - margin; | |
26 | img_h = win_h; |
|
28 | img_h = win_h - margin; | |
27 | } |
|
29 | } | |
28 |
|
30 | |||
29 | var img_pv = new Image(); |
|
31 | var img_pv = new Image(); |
General Comments 0
You need to be logged in to leave comments.
Login now