Ignore:
Timestamp:
Jan 20, 2011, 4:44:46 PM (13 years ago)
Author:
cljosse
Message:

[Autosize][beta] center picture in class "autosize"


File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/Autosize/js/Affiche_script.js

    r8792 r8807  
    8484    var winwidth = jQuery(window).width();
    8585    var winheight = jQuery(window).height();
    86     h1 = jQuery(Obj).infos();
    87         h1 = (winheight - h1.top - 5);
    88         rap = jQuery(Obj).find("img").height() / jQuery(Obj).find("img").width();
    89         Obj.height(h1);   w1=(h1 / rap);
    90         Obj.css({ height: h1 + "px",width:w1+"px", margin: "auto" });
    91         img = jQuery(Obj).find("img") ;
     86    info_Obj = jQuery(Obj).infos();
     87    h1_left = jQuery(Obj).absoluteLeft();
     88        h1_top = jQuery(Obj).absoluteTop();
     89        h1 = (winheight - h1_top);
     90     img = jQuery(Obj).find("img") ;
     91     rap = jQuery(img).height() / jQuery(img).width();
     92     w2 = (h1 / rap);
     93     
     94     if (w2 < info_Obj.width)
     95         marginLeft = info_Obj.left + parseInt((info_Obj.width - w2) / 2)+"px";
     96     else
     97         marginLeft = "auto";
     98     Obj.css({ width: "auto",
     99         marginLeft: "auto",
     100              verticalAlign: "middle", textAlign: "center"
     101               });
     102        Obj.height(h1);
     103         
     104
    92105           img.height(h1);       
    93            img.width(w1);             
     106           img.width(w2);             
    94107
    95108
     
    12231236        info_description.bottom -= info_img.top;
    12241237    }
    1225     if (msie == true) info_description.bottom -= 4;
     1238 //   if (msie == true) info_description.bottom -= 4;
    12261239
    12271240    info_description.height = info_description.bottom - info_description.top;
Note: See TracChangeset for help on using the changeset viewer.