[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 var maxHeight = 550; 2 var maxListHeight = 120; 3 4 function init() { 5 if (document.getElementById("singleimage")) single(); 6 /*else if (document.getElementById("pictures")) list();*/ 7 } 8 9 function list() { 10 imageDivs = document.getElementsByName("listimage"); 11 for (i=0; i < imageDivs.length; i++) { 12 currentHeight = imageDivs[i].offsetHeight; 13 currentWidth = imageDivs[i].offsetWidth; 14 15 if (currentHeight > maxListHeight) { 16 ratio = maxListHeight / currentHeight; 17 imageDivs[i].style.width = (currentWidth*ratio) + 'px'; 18 imageDivs[i].style.height = (currentHeight*ratio) + 'px'; 19 imageDivs[i].firstChild.style.height = '100%'; 20 imageDivs[i].firstChild.style.width = '100%'; 21 } 22 } 23 } 24 25 function single() { 26 var imageDiv = document.getElementById("singleimage"); 27 28 if (imageDiv) { 29 currentHeight = imageDiv.offsetHeight; 30 currentWidth = imageDiv.offsetWidth; 31 32 if (currentHeight > maxHeight) { 33 ratio = maxHeight / currentHeight; 34 imageDiv.style.width = (currentWidth*ratio) + 'px'; 35 imageDiv.style.height = (currentHeight*ratio) + 'px'; 36 37 } 38 } 39 } 40 41 window.onload = init;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |