Changeset 8807 for extensions/Autosize


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

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


Location:
extensions/Autosize
Files:
3 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;
  • extensions/Autosize/js/jquery.dimensions.js

    r8729 r8807  
    5858            }) : this[0] == window || this[0] == document ? self[(name == 'Left' ? 'pageXOffset' : 'pageYOffset')] || jQuery.boxModel && document.documentElement['scroll' + name] || document.body['scroll' + name] : this[0]['scroll' + name];
    5959        };
     60        //================================================
     61        jQuery.fn['absolute' + name] = function (val) {
     62            if (!this[0]) return;
     63                       a = jQuery(this[0]);
     64            m = 0;
     65            while (a.length > 0) {
     66                val = jQuery(a).infos();
     67                if (val.position != "absolute") {
     68                    m += name == 'Left' ? val.left : val.top;
     69                    m += name == 'Left' ? val.margin.left : val.margin.top;
     70                    m += name == 'Left' ? val.margin.right : val.margin.bottom;
     71                    m += name == 'Left' ? val.borderwidth.left : val.borderwidth.top;
     72                 //   m += name == 'Left' ? val.borderwidth.right : val.borderwidth.bottom;
     73                 //   m += name == 'Left' ? val.padding.left : val.padding.top;
     74                 //   m += name == 'Left' ? val.padding.right : val.padding.bottom;
     75                     a = jQuery(a).offsetParent();
     76                } else
     77                    break;
     78
     79            }
     80            //306
     81
     82
     83            return m;
     84
     85
     86        };
     87
    6088
    6189    });
     90    //=====================================================
    6291    jQuery.fn.extend({
    6392
     
    159188                    Cl_Position = { Top: 0, Left: 0 };
    160189                } else {
    161                     Cl_Position = jQuery(elem).position();
     190                    Cl_Position = jQuery(elem).d_position();
    162191                }
    163192                Left = Cl_Position.left;
     
    185214        * Cl_Position de l'object elem
    186215        */
    187         position: function () {
     216        d_position: function () {
    188217            var left = 0, top = 0, elem = this[0], offset, parentOffset, offsetParent, results;
    189218
  • extensions/Autosize/main.inc.php

    r8792 r8807  
    22/*
    33Plugin Name: AutoSize
    4 Version: 1.4.33
     4Version: 1.4.34
    55Description: Ajuste l'affichage des photos en fonction de la hauteur de la fenetre de navigation
    66Plugin URI: http://piwigo.org/ext/extension_view.php?eid=448
Note: See TracChangeset for help on using the changeset viewer.