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

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

[Autosize]fix bugs


File size: 3.1 KB
Line 
1jQuery.noConflict();
2jQuery(document).ready(
3function (jQuery) {
4    //===================================================================       
5
6
7    jQuery(window).resize(function (event, ui) {
8        if (typeof (event) == 'undefined') return;
9
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                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;
25        }
26
27        var sel0 = jQuery(TheImg).position();
28        if (!sel0) return;
29
30        mini_width = parseInt(mini_width);
31        mini_height = parseInt(mini_height);
32
33        W0 = parseInt(img_width);
34        if (W0 < mini_width) return;
35
36        H0 = parseInt(img_height);
37        if (H0 < parseInt(mini_height)) return;
38
39        var rapport = (W0 / H0);
40
41        var Licence = jQuery("#theImage").find(".licencetag");
42        if (Licence.length > 0) {
43            var lmt = jQuery(Licence.get(0)).height();
44            jQuery(Licence.get(0)).css("top", "0px");
45
46        } else { var lmt = 0; }
47
48
49        var winheight = jQuery(window).height();
50        var Image_height = (winheight - sel0.top) - parseInt(marge_basse) - lmt;
51        var height_user = eval(user_status + "_height");
52        var width_user = eval(user_status + "_width");
53        //=============================================================
54        var reg1 = new RegExp("%", "g");
55        if (height_user.match(reg1))
56            Image_height = Image_height * parseInt(height_user) / 100;
57        else
58            Image_height = parseInt(height_user);
59        //=============================================================
60
61        var echelle = Image_height / H0;
62
63        if (echelle > parseInt(echelle_max)) {
64            echelle = echelle_max;
65            Image_height = parseInt(img_height * echelle);
66        }
67
68        var Imgage_Width = parseInt(Image_height * rapport);
69
70        jQuery(TheImg).height(Image_height + "px");
71        jQuery(TheImg).width(Imgage_Width + "px");
72
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;
77
78        jQuery("#theImage").height(Image_height + "px");
79
80
81
82        jQuery("#theImage").width("100%");
83        try {
84            // pour les themes Gally
85            initializeImageMode('resize');
86        } catch (e) { }
87        return;
88    });
89
90    //===================================================================         
91    jQuery(window).resize();
92
93    jQuery(window).resize();
94
95});   
96
97//=========================================================
98 
Note: See TracBrowser for help on using the repository browser.