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