##// END OF EJS Templates
delegate, small fix for gallery mode,
rt@lightning -
r252:5b2002ce default
parent child Browse files
Show More
@@ -6,8 +6,7 b' function addImgPreview() {'
6 }
6 }
7 });
7 });
8
8
9 $('.thumb').each(function() {
9 $('body').on('click', '.thumb', function() {
10 $(this).on('click', function() {
11 var el = $(this);
10 var el = $(this);
12 var thumb_id = 'full'+el.find('img').attr('alt');
11 var thumb_id = 'full' + el.find('img').attr('alt');
13
12
@@ -17,7 +16,6 b' function addImgPreview() {'
17
16
18 var win_w = $(window).width();
17 var win_w = $(window).width();
19 var win_h = $(window).height();
18 var win_h = $(window).height();
20
21 //new image size
19 //new image size
22 if (img_w > win_w) {
20 if (img_w > win_w) {
23 img_h = img_h * (win_w/img_w);
21 img_h = img_h * (win_w/img_w);
@@ -29,7 +27,6 b' function addImgPreview() {'
29 }
27 }
30
28
31 var img_pv = new Image();
29 var img_pv = new Image();
32
33 $(img_pv)
30 $(img_pv)
34 .addClass('img-full')
31 .addClass('img-full')
35 .attr('id', thumb_id)
32 .attr('id', thumb_id)
@@ -41,7 +38,6 b' function addImgPreview() {'
41 'left': (win_w - img_w) / 2,
38 'left': (win_w - img_w) / 2,
42 'top': ((win_h - img_h) / 2)
39 'top': ((win_h - img_h) / 2)
43 })
40 })
44
45 //scaling preview
41 //scaling preview
46 .mousewheel(function(event, delta) {
42 .mousewheel(function(event, delta) {
47 var cx = event.originalEvent.clientX,
43 var cx = event.originalEvent.clientX,
@@ -53,7 +49,6 b' function addImgPreview() {'
53
49
54 $(img_pv).width(newIW);
50 $(img_pv).width(newIW);
55 $(img_pv).height(newIH);
51 $(img_pv).height(newIH);
56
57 //set position
52 //set position
58 $(img_pv)
53 $(img_pv)
59 .css({
54 .css({
@@ -68,9 +63,7 b' function addImgPreview() {'
68 else {
63 else {
69 $('#'+thumb_id).remove();
64 $('#'+thumb_id).remove();
70 }
65 }
71
72 //prevent default
66 //prevent default
73 return false;
67 return false;
74 });
68 });
75 });
76 } No newline at end of file
69 }
@@ -49,6 +49,9 b' function tab_handler(ev)'
49 $('#posts').replaceWith(table_dom);
49 $('#posts').replaceWith(table_dom);
50 break;
50 break;
51 }
51 }
52
53 //TODO: временно
54 addImgPreview();
52 }
55 }
53
56
54 function make_normal_dom()
57 function make_normal_dom()
@@ -70,8 +73,6 b' function make_table_dom()'
70 );
73 );
71 }
74 }
72 );
75 );
73 //TODO: временно
74 addImgPreview();
75 }
76 }
76
77
77 function moveCaretToEnd(el) {
78 function moveCaretToEnd(el) {
General Comments 0
You need to be logged in to leave comments. Login now