Changeset 8911 for extensions/Autosize/js/Affiche_script.js
- Timestamp:
- Jan 26, 2011, 12:52:35 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Autosize/js/Affiche_script.js
r8864 r8911 51 51 function Wait_Affichage() { 52 52 fade_in = parseInt(fade_in); 53 53 54 54 if (!jQuery().newResize()) { 55 55 setTimeout("Wait_Affichage()", 500); 56 56 return 57 57 } 58 nu_img++;58 nu_img++; 59 59 if (fade_in == 0) { 60 60 jQuery(Parent).css({ opacity: "1" }); … … 73 73 } 74 74 ); 75 76 77 78 75 } 76 // if (nu_img > 1) return; 77 78 79 79 80 80 img_h = jQuery(TheImg).height(); … … 85 85 jQuery("#ret_autosize").val(src_img); 86 86 87 jQuery("#ret_autosize").trigger('ON' );87 jQuery("#ret_autosize").trigger('ON', { width: img_w, height: img_w, theImage: TheImg, src_img: src_img }); 88 88 89 89 … … 97 97 98 98 99 100 99 conf = jQuery(Obj).get(0).conf; 101 100 Obj = jQuery(Obj).get(0).obj; 102 101 myWindow = jQuery("#" + conf.parent).infos(); 103 102 104 if (myWindow == 0) myWindow = jQuery(window).infos();103 if (myWindow.width == 0) myWindow = jQuery(window).infos(); 105 104 marge_basse = 0; 106 105 if (conf.MargeBasse) … … 108 107 conf.MargeBasse 109 108 ); 109 marge_top = 0; 110 if (conf.MargeHaute) 111 marge_top = jQuery().Get_Val_int( 112 conf.MargeHaute 113 ); 114 110 115 info_Obj = jQuery(Obj).infos(); 111 116 h1_left = jQuery(Obj).absoluteLeft(); 112 117 h1_top = jQuery(Obj).absoluteTop(); 113 if (typeof old_h1 == "undefined") old_h1 = 0;114 115 116 118 117 119 if (h1_top < info_Obj.height) 118 h1 = (myWindow.height - h1_top - marge_basse );120 h1 = (myWindow.height - h1_top - marge_basse - marge_top); 119 121 else 120 122 h1 = (myWindow.height - marge_basse); 121 123 122 if (h1 == old_h1) return; 123 old_h1 = h1; 124 125 imgs = jQuery(Obj).find("img"); 126 rap = jQuery(imgs).height() / jQuery(imgs).width(); 127 w2 = (h1 / rap); 128 129 // ("source:" + message); 124 125 rap = info_Obj.height / info_Obj.width; 126 w2 = parseInt(h1 / rap); 130 127 131 128 if (w2 < info_Obj.width) … … 134 131 marginLeft = "auto"; 135 132 136 jQuery(Obj).css({ width: "auto", 133 jQuery(Obj).css({ width: "auto",marginTop:marge_top, 137 134 marginLeft: "auto", marginBottom: 0 + "px", 138 135 verticalAlign: "middle", textAlign: "center" 139 136 }); 140 137 jQuery(Obj).height(h1); 138 141 139 //============================================================= 142 140 if (conf.ResizePicture != "true") { 143 141 144 142 } else 145 jQuery(imgs).each(function (i) { 146 img = jQuery(this); 147 rap = jQuery(this).height() / jQuery(this).width(); 148 w2 = parseInt(h1 / rap); 149 if (w2 > 0 && h1 > 0 && img.length > 0) { 150 img.height(h1); 151 img.width(w2); 152 } 153 154 }); 143 imgs = jQuery(Obj).find("img"); 144 Obj_w = jQuery(Obj).width(); 145 Obj_h = jQuery(Obj).height(); 146 147 jQuery(imgs).each(function (i) { 148 img = jQuery(this); 149 150 info_img = { width: conf.width[i], height: conf.height[i] }; 151 img_rap = conf.rap[i]; 152 153 if (info_img.width > Obj_w) h1 = parseInt(Obj_w / img_rap); 154 else w2 = parseInt(Obj_h * img_rap); 155 if (w2 > 0 && h1 > 0 && img.length > 0) { 156 img.height(h1); 157 img.width(w2); 158 } 159 160 }); 155 161 156 162 … … 176 182 conf[jQuery.trim(tableau2[0])] = jQuery.trim(tableau2[1]); 177 183 } 184 imgs = jQuery(a).find("img"); 185 rap = new Array(); 186 width = new Array(); 187 height = new Array(); 188 jQuery(imgs).each(function (i) { 189 img = jQuery(this); 190 rap.push((img.width() / img.height())); 191 width.push( img.width() ); 192 height.push( img.height() ); 193 }); 194 195 conf['rap'] = rap; 196 conf['width'] = width; 197 conf['height'] = height; 178 198 179 199 List_autosize.push({ obj: a, conf: conf }); … … 190 210 191 211 function List_autosize_resize(event, ui) { 212 if (typeof wait_resize == "undefined") wait_resize = false; 213 if (wait_resize == true) return; 214 215 wait_resize = true; 192 216 if (List_autosize.length == 0) return; 193 217 for (i = 0; i < List_autosize.length; i++) { 194 218 Autosize_resize(jQuery(List_autosize[i])); 195 219 } 220 wait_resize = false; 196 221 197 222 }
Note: See TracChangeset
for help on using the changeset viewer.