Changeset 6978 for extensions/Autosize/js
- Timestamp:
- Sep 20, 2010, 5:31:13 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Autosize/js/Affiche_script.js
r6954 r6978 1 1 jQuery.noConflict(); 2 2 jQuery(document).ready( 3 4 3 5 function (jQuery) { 6 function Marge_haute(myObj, ajoute_h) { 7 if (ajoute_h) h_p = parseInt(jQuery(myObj).height()); 8 else h_p = 0; 9 10 if (jQuery(myObj).css("marginTop")) 11 if (jQuery(myObj).css("marginTop") != "auto") h_p += parseInt(jQuery(myObj).css("marginTop")); 12 if (jQuery(myObj).css("marginBottom")) 13 if (jQuery(myObj).css("marginBottom") != "auto") h_p += parseInt(jQuery(myObj).css("marginBottom")); 14 if (jQuery(myObj).css("paddingTop")) 15 if (jQuery(myObj).css("paddingTop") != "auto") h_p += parseInt(jQuery(myObj).css("paddingTop")); 16 if (parseInt(jQuery(myObj).css("paddingBottom"))) 17 if (jQuery(myObj).css("paddingBottom") != "auto") h_p += parseInt(jQuery(myObj).css("paddingBottom")); 18 return h_p; 19 } 4 20 //=================================================================== 21 5 22 6 23 7 24 jQuery(window).resize(function (event, ui) { 8 25 if (typeof (event) == 'undefined') return; 26 9 27 var Type_Img = ""; 10 28 //====== détection du type d'images ====== … … 22 40 return; 23 41 } 42 43 24 44 //================================================================= 25 45 switch (Type_Img) { 26 46 case "img": 27 47 var Image = jQuery("#theImage").find("img"); 28 var TheImg = jQuery(Image).get(0); 48 var TheImg = jQuery("#theImg").find("img").get(0); 49 if (!TheImg) 50 TheImg = jQuery(Image).get(0); 29 51 break 30 52 case "img_autre": … … 39 61 break 40 62 case "pamoorama": 63 //========================================================= 41 64 var Images = jQuery("#pamoorama"); 42 65 var Image = jQuery(Images).get(0); … … 44 67 var TheImg = jQuery("#pamoorama").get(0); 45 68 if (!TheImg) return; 69 TheImg = jQuery("#pamoorama_inner"); 70 if (TheImg.length < 1) return; 71 46 72 break 47 73 } … … 49 75 //================================================================================== 50 76 var sel0 = jQuery(TheImg).position(); 77 51 78 if (!sel0) return; 79 type_pos = jQuery(TheImg).css("position"); //static 80 if (jQuery(TheImg).css("position") == "relative") { 81 sel0.top += Marge_haute("#theHeader", true); 82 sel0.top += Marge_haute("#imageHeaderBar", true); 83 sel0.top += Marge_haute(TheImg, false); 84 if (jQuery("#theImage").css("marginTop")) 85 if (jQuery("#theImage").css("marginTop") != "auto") sel0.top += parseInt(jQuery("#theImage").css("marginTop")); 86 if (jQuery("#theImage").css("paddingTop")) 87 if (jQuery("#theImage").css("paddingTop") != "auto") sel0.top += parseInt(jQuery("#theImage").css("paddingTop")); 88 89 } 52 90 53 91 mini_width = parseInt(mini_width); … … 81 119 for (var i = 0; i < Pars.length; i++) { 82 120 P0 = Pars.get(i); 83 h_p += parseInt(jQuery(P0).height()); 84 if (jQuery(P0).css("marginTop")) 85 if (jQuery(P0).css("marginTop") != "auto") h_p += parseInt(jQuery(P0).css("marginTop")); 86 if (jQuery(P0).css("marginBottom")) 87 if (jQuery(P0).css("marginBottom") != "auto") h_p += parseInt(jQuery(P0).css("marginBottom")); 88 if (jQuery(P0).css("paddingTop")) h_p += parseInt(jQuery(P0).css("paddingTop")); 89 if (parseInt(jQuery(P0).css("paddingBottom"))) h_p += parseInt(jQuery(P0).css("paddingBottom")); 90 121 h_p += Marge_haute(P0, true); 91 122 } 92 123 … … 101 132 var Image_height = (winheight - sel0.top) - parseInt(marge_basse) - lmt; 102 133 var height_user = eval(user_status + "_height"); 103 var width_user = eval(user_status + "_width"); 134 104 135 //============================================================= 105 136 var reg1 = new RegExp("%", "g"); … … 108 139 else 109 140 Image_height = parseInt(height_user); 110 //============================================================= 141 142 //============================================================ 111 143 echelle_max = parseFloat(echelle_max, '3'); 112 144 var echelle = parseFloat(Image_height / H0, 3); … … 117 149 } 118 150 119 var Imgage_Width = parseInt(Image_height * rapport); 120 jQuery("#theImage").width("100%"); 121 jQuery("#theImage").height("auto"); 122 123 151 var Image_Width = parseInt(Image_height * rapport); 152 153 //=============================================================== 154 twidth = jQuery("#imageHeaderBar").width(); 155 img_la = jQuery(TheImg).width(); //initiale 156 offset = jQuery(TheImg).position(); 157 158 var winwidth = jQuery(window).width(); 159 var width_user = eval(user_status + "_width"); 160 161 if (check_auto_w == 'checked="checked"') { 162 if (Type_Img != "pamoorama") { 163 widthmin = (winwidth - offset.left); 164 165 if (Image_Width > widthmin) { 166 //============================================================= 167 if (width_user.match(reg1)) 168 Image_Width = Image_Width * parseInt(width_user) / 100; 169 else 170 Image_Width = parseInt(width_user); 171 172 var echelle_w = parseFloat(winwidth / W0, 3); 173 if (echelle_w > echelle_max) { 174 echelle_w = echelle_max; 175 Image_Width = parseInt(W0 * echelle_w); 176 } 177 Image_Width = parseInt(W0 * echelle_w); 178 179 align_auto = "left"; 180 } else { 181 182 align_auto = "center"; 183 } 184 Image_height = parseInt(Image_Width / rapport); 185 186 } 187 188 189 } 190 //============================================================= 124 191 125 192 if (Type_Img == "pamoorama") { 126 h1 = jQuery("#pamoorama").height(); 127 jQuery("#pamoorama").css("overflow", "hidden"); 128 jQuery("#pamoorama").css(jQuery(window).width() + "px"); 129 193 194 195 jQuery("#pamoorama").css("height", Image_height + "px"); 196 jQuery("#pamoorama").css("width", twidth + "px"); 197 198 jQuery("#pamoorama").height(Image_height + "px"); 199 jQuery("#pamoorama").width(twidth + "px"); 200 201 202 203 jQuery("#pamoorama_outter").height(Image_height + "px"); 204 jQuery("#pamoorama_outter").width(twidth + "px"); 205 130 206 jQuery("#pamoorama_outter").css("height", Image_height + "px"); 131 jQuery("#pamoorama_outter").css("width", jQuery(window).width() + "px"); 132 /* 133 jQuery(TheImg).css(Image_height + "px"); 134 jQuery(TheImg).css(jQuery(window).width() + "px"); 135 */ 207 jQuery("#pamoorama_outter").css("width", twidth + "px"); 208 136 209 zoom = Image_height / img_height; 137 210 138 jQuery("#pamoorama_inner").css("zoom", zoom); 211 h_frame = jQuery("#pamoorama_frame").height(); 212 h_width = jQuery("#pamoorama_frame").width(); 213 jQuery(TheImg).css("zoom", zoom); 139 214 140 215 141 216 142 217 } else { 143 jQuery(TheImg).height(Image_height + "px"); 144 jQuery(TheImg).width(Imgage_Width + "px"); 218 if (jQuery("#theImg").css("textAlign")) 219 jQuery("#theImg").css("textAlign", align_auto); 220 221 jQuery(TheImg).height(Image_height + "px"); 222 jQuery(TheImg).width(Image_Width + "px"); 223 jQuery(TheImg).css("height", Image_height + "px"); 224 jQuery(TheImg).css("width", Image_Width + "px"); 145 225 146 226 } … … 155 235 156 236 //=================================================================== 237 157 238 jQuery(window).resize(); 239 158 240 jQuery(window).resize(); 159 241
Note: See TracChangeset
for help on using the changeset viewer.