source: extensions/Autosize/js/Affiche_script.js @ 6915

Last change on this file since 6915 was 6915, checked in by cljosse, 14 years ago

[Autosize]Fix bugs


File size: 2.9 KB
Line 
1jQuery(document).ready(
2function (jQuery) {
3    //===================================================================       
4
5
6    jQuery(window).resize(function (event, ui) {
7        if (typeof (event) == 'undefined') return;
8        var Image = jQuery("#theImage").find("embed");
9        if (Image.length == 0) {
10
11            var Image = jQuery("#theImage").find("img");
12            if (Image.length == 0) return;
13        } else {
14            var TheImg = jQuery(Image).get(0);
15            img_height = TheImg.clientHeight;
16            img_width = TheImg.clientWidth;
17        }
18        var TheImg = jQuery(Image).get(0);
19       
20        H00 = jQuery(TheImg).height();
21        W00 = jQuery(TheImg).width();
22
23        var sel0 = jQuery(TheImg).position();
24        if (!sel0) return;
25
26        W0 = parseInt(img_width);
27        if (W0 < parseInt(mini_width)) return;
28
29        H0 = parseInt(img_height);
30        if (H0 < parseInt(mini_height)) return;
31
32        var rapport = (W0 / H0);
33       
34        var Licence = jQuery("#theImage").find(".licencetag");
35        if (Licence.length > 0) {
36            var lmt = jQuery(Licence.get(0)).height();
37            jQuery(Licence.get(0)).css("top", "0px");
38
39        } else { var lmt = 0; }
40
41
42        var winheight = jQuery(window).height();
43        var Image_height = (winheight - sel0.top) - parseInt(marge_basse) - lmt;
44        var height_user = eval(user_status + "_height");
45        var width_user = eval(user_status + "_width");
46        //=============================================================
47        var reg1 = new RegExp("%", "g");
48        if (height_user.match(reg1))
49            Image_height = Image_height * parseInt(height_user) / 100;
50        else
51            Image_height = parseInt(height_user);
52        //=============================================================
53
54        var echelle = Image_height / H0;
55
56        if (echelle > parseInt(echelle_max)) {
57            echelle = echelle_max;
58            Image_height = parseInt(img_height * echelle);
59        }
60
61        var Imgage_Width = parseInt(Image_height * rapport);
62
63        jQuery(TheImg).height(Image_height + "px");
64        jQuery(TheImg).width(Imgage_Width + "px");
65
66        jQuery("img.logo88x31").css("position", "relative");
67        jQuery("#theImage").css("paddingBottom", "0px");
68        lmt = jQuery("#theImage span").height();
69        var top = jQuery("#theImage").position().top;
70        jQuery("#theImage").height(Image_height + "px");
71
72        jQuery("#theImage").width("100%");
73        try {
74            // pour les themes Gally
75            initializeImageMode('resize');
76        } catch (e) { }
77        return;
78    });
79
80    //===================================================================         
81    jQuery(window).resize();
82
83    jQuery(window).resize();
84
85});   
86
87//=========================================================
88 
Note: See TracBrowser for help on using the repository browser.