Ignore:
Timestamp:
Jul 15, 2012, 7:44:26 PM (12 years ago)
Author:
gbo
Message:

2.4F improve frame management first size and JS resize

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/LLGBO2/js/jquery_llgboframeresize.js

    r15076 r16754  
    11// LLGBO frame resize
    22jQuery(document).ready(function(jQuery){
    3         jQuery("#theMainImage").load(function(){LlgboFr_Resize();});   
    4         jQuery(window).resize(function(){ LlgboFr_Resize(); });
     3         jQuery("#theMainImage").load(function(){LlgboFr_Resize();});   
     4        jQuery(window).resize(function(){ LlgboFr_Resize(); }); 
    55});
    66var LlgboFr_Resize = function () {
    7         var MainImg = jQuery("img#theMainImage").get(0);       
    8         var nFrH = parseInt(MainImg.height);
    9         var nFrW = parseInt(MainImg.width);
    10         var FrLstBdr = 0, i = 0;
    11         var elGbo = jQuery("div#llgbo");
    12         if  (elGbo.get(0)) {
    13                 for ( i=1; i<32; i=i+2 )
    14                         {var Fr = jQuery("div#llgboframe"+(i));
    15                          var frbdr = 0;
    16                          if (Fr.get(0)) {
    17                                 frbdr = parseInt(Fr.css('border-left-width'));
    18                                 nFrH = nFrH + FrLstBdr ;
    19                                 nFrW = nFrW + FrLstBdr ;
    20                                 Fr.css("height", (nFrH) + "px");
    21                                 Fr.css("width", (nFrW) + "px");}
    22                                 FrLstBdr = (frbdr * 2);
    23                         }
    24                         elGbo.css("width", (nFrW + FrLstBdr) + "px");
    25                         elGbo.css("height", (nFrH + FrLstBdr) + "px");
     7        var elGbo = document.getElementById("llgbo0");
     8         if  (elGbo) {
     9            var MainImg = document.getElementById("theMainImage");
     10                var nFrH = parseInt(MainImg.height);
     11                var nFrW = parseInt(MainImg.width);
     12                var ReadImgSize = document.getElementById("LLGBO_READIMGREELSIZE");
     13                 if (ReadImgSize) {
     14                 // Must read via URL the physical size of the img
     15                         var x = document.createElement('img');
     16                         x.id = 'NewImgx';
     17                         document.getElementsByTagName('body')[0].appendChild(x);
     18                         x.style.top = '0';
     19                         x.style.visibility = 'hidden';
     20                         x.src =  MainImg.src;
     21                         nFrH = parseInt(x.height);
     22                         nFrW = parseInt(x.width);
     23                        document.getElementsByTagName('body')[0].removeChild(x);
    2624                }
     25       
     26                var FrLstBdr = 0, i = 0;
     27                        for ( i=1; i<32; i=i+2 )
     28                                {var Fr = document.getElementById("llgboframe"+(i));
     29                                 var frbdr = 0;
     30                                 if (Fr) {
     31                                        frbdr = parseInt(Fr.style.borderWidth);
     32                                        nFrH = nFrH + FrLstBdr ;
     33                                        nFrW = nFrW + FrLstBdr ;
     34                                        Fr.style.height = nFrH + "px";
     35                                        Fr.style.width = nFrW + "px";}
     36                                        FrLstBdr = (frbdr * 2); 
     37                                }
     38                                elGbo.style.width = (nFrW + FrLstBdr) + "px";
     39                                elGbo.style.height =(nFrH + FrLstBdr) + "px";
     40                }               
    2741}
Note: See TracChangeset for help on using the changeset viewer.