Changeset 6936 for extensions/Autosize/js
- Timestamp:
- Sep 16, 2010, 3:20:19 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Autosize/js/Affiche_script.js
r6933 r6936 7 7 jQuery(window).resize(function (event, ui) { 8 8 if (typeof (event) == 'undefined') return; 9 var Type_Img = ""; 10 //====== détection du type d'images ====== 11 var Image = jQuery("#theImage").find("embed"); 12 if (Image.length > 0) { 13 Type_Img = "embed"; 14 } else if (jQuery("#pamoorama").length) { 15 16 Type_Img = "pamoorama"; 17 } else if (jQuery("#theImage").find("img").length > 0) { 18 Type_Img = "img"; 19 } else if (jQuery("img").length > 0) { 20 Type_Img = "img_autre"; 21 } else { 22 return; 23 } 24 //================================================================= 25 switch (Type_Img) { 26 case "img": 27 var Image = jQuery("#theImage").find("img"); 28 var TheImg = jQuery(Image).get(0); 29 break 30 case "img_autre": 31 var Image = jQuery("img"); 32 var TheImg = jQuery(Image).get(0); 33 break 34 case "embed": 35 var Image = jQuery("#theImage").find("embed"); 36 var TheImg = jQuery(Image).get(0); 37 img_height = TheImg.clientHeight; 38 img_width = TheImg.clientWidth; 39 break 40 case "pamoorama": 41 var Images = jQuery("#pamoorama"); 42 var Image = jQuery(Images).get(0); 9 43 10 11 var Image = jQuery("#theImage").find("embed");12 if (Image.length == 0) {13 var Image = jQuery("#theImage").find("img");14 if (Image.length == 0) {15 Image = jQuery("#pamoorama");16 44 if (!Image) return; 17 } 18 TheImg = jQuery(Image).get(0); 19 img_height = jQuery(TheImg).height(); 20 img_width = jQuery(TheImg).width(); 21 } else { 22 var TheImg = jQuery(Image).get(0); 23 img_height = TheImg.clientHeight; 24 img_width = TheImg.clientWidth; 45 var TheImg = jQuery(Image); 46 break 25 47 } 26 48 49 //================================================================================== 27 50 var sel0 = jQuery(TheImg).position(); 28 51 if (!sel0) return; … … 38 61 39 62 var rapport = (W0 / H0); 40 63 //========================================================================== 41 64 var Licence = jQuery("#theImage").find(".licencetag"); 42 65 if (Licence.length > 0) { 43 66 var lmt = jQuery(Licence.get(0)).height(); 67 h_p = jQuery(Licence.get(0)).height(); 68 jQuery(Licence.get(0)).css("position", "relative"); 69 44 70 jQuery(Licence.get(0)).css("top", "0px"); 45 71 46 } else { var lmt = 0; } 72 } else { 73 var lmt = 0; 47 74 75 } 76 //==== paragraphe supplèmentaire === 77 if (jQuery("#theImage").find("p")) { 78 h_p = 0; 79 Pars = jQuery("#theImage").find("p"); 48 80 81 for (var i = 0; i < Pars.length; i++) { 82 P0 = Pars.get(i); 83 h_p += parseInt(jQuery(P0).height()); 84 if (P0.currentStyle.marginTop) 85 if (P0.currentStyle.marginTop != "auto") h_p += parseInt(P0.currentStyle.marginTop); 86 if (P0.currentStyle.marginBottom) 87 if (P0.currentStyle.marginBottom != "auto") 88 h_p += parseInt(P0.currentStyle.marginBottom); 89 if (P0.currentStyle.PaddingTop) h_p += parseInt(P0.currentStyle.PaddingTop); 90 if (parseInt(P0.currentStyle.PaddingBottom)) h_p += parseInt(P0.currentStyle.PaddingBottom); 91 92 } 93 94 // n_t = (p_p.top - Image_height) + h_p; 95 96 lmt += h_p; 97 jQuery("#theImage").css("paddingBottom", 0 + "px"); 98 } 99 100 //========================================================================== 49 101 var winheight = jQuery(window).height(); 50 102 var Image_height = (winheight - sel0.top) - parseInt(marge_basse) - lmt; … … 58 110 Image_height = parseInt(height_user); 59 111 //============================================================= 112 echelle_max = parseFloat(echelle_max, '3'); 113 var echelle = parseFloat(Image_height / H0, 3); 60 114 61 var echelle = Image_height / H0; 62 63 if (echelle > parseInt(echelle_max)) { 115 if (echelle > echelle_max) { 64 116 echelle = echelle_max; 65 Image_height = parseInt( img_height* echelle);117 Image_height = parseInt(H0 * echelle); 66 118 } 67 119 68 120 var Imgage_Width = parseInt(Image_height * rapport); 121 jQuery("#theImage").width("100%"); 122 jQuery("#theImage").height("auto"); 123 jQuery(TheImg).height(Image_height + "px"); 124 jQuery(TheImg).width(Imgage_Width + "px"); 69 125 70 jQuery(TheImg).height(Image_height + "px"); 71 jQuery(TheImg).width(Imgage_Width + "px"); 126 if (Type_Img = "pamoorama") { 72 127 73 jQuery("img.logo88x31").css("position", "relative");74 jQuery("#theImage").css("paddingBottom", "0px");75 lmt = jQuery("#theImage span").height();76 var top = jQuery("#theImage").position().top;128 return; 129 jQuery("#pamoorama_inner").css("zoom", "1"); 130 jQuery("#pamoorama_inner").css("height", Image_height + "px"); 131 jQuery("#pamoorama_inner").css("width", Imgage_Width + "px"); 77 132 78 jQuery("#theImage").height(Image_height + "px"); 133 jQuery("#pamoorama_outter").css("zoom", "1"); 134 jQuery("#pamoorama_outter").css("height", Image_height + "px"); 135 jQuery("#pamoorama_outter").css("width", Imgage_Width + "px"); 79 136 80 137 138 } else { 139 81 140 82 jQuery("#theImage").width("100%"); 141 } 142 143 83 144 try { 84 145 // pour les themes Gally … … 90 151 //=================================================================== 91 152 jQuery(window).resize(); 92 93 153 jQuery(window).resize(); 94 154
Note: See TracChangeset
for help on using the changeset viewer.