source: extensions/LLGBO2/js/jquery_llgboframeresize.js @ 16754

Last change on this file since 16754 was 16754, checked in by gbo, 12 years ago

2.4F improve frame management first size and JS resize

File size: 1.4 KB
Line 
1// LLGBO frame resize
2jQuery(document).ready(function(jQuery){ 
3         jQuery("#theMainImage").load(function(){LlgboFr_Resize();});   
4        jQuery(window).resize(function(){ LlgboFr_Resize(); }); 
5});
6var LlgboFr_Resize = function () {
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);
24                }
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                }               
41}
Note: See TracBrowser for help on using the repository browser.