Team:Goettingen/Team/Gallery
From 2013.igem.org
(Difference between revisions)
m |
|||
Line 236: | Line 236: | ||
- | + | ||
+ | function adjustSize(){ | ||
+ | ration = garPic.height/garPic.width; | ||
+ | adHeight = $(window).height()*0.8; | ||
+ | adWidth = $(window).width()*0.8; | ||
+ | ratio = garPic.height/garPic.width; | ||
+ | if( garPic.height/garPic.width > adHeight/adWidth) {garPic.style.height = adHeight + 'px'; | ||
+ | garPic.style.width = adHeight/ratio + 'px';} | ||
+ | if( garPic.height/garPic.width < adHeight/adWidth) {garPic.style.width = adWidth + 'px'; } | ||
+ | showbox.style.width = garPic.style.width; | ||
+ | prefoto.style.top = (garPic.height - prefoto.height)/2 + 'px'; | ||
+ | nextfoto.style.top = (garPic.height - prefoto.height)/2 + 'px'; | ||
+ | showbox.style.marginLeft = ($(window).width() - garPic.width)/2 + 'px'; | ||
+ | closebtn.style.right = '0px'; | ||
+ | lightframe.style.left = '0px'; | ||
+ | } | ||
+ | |||
+ | function finalize(){ | ||
+ | garPic.style.height = ''; | ||
+ | garPic.style.width = ''; | ||
+ | prefoto.style.top = ''; | ||
+ | nextfoto.style.top = ''; | ||
+ | garPic.style.marginLeft = ''; | ||
+ | } | ||
+ | |||
function showGarPic(from,illustration,alb){ | function showGarPic(from,illustration,alb){ | ||
currentAlb = alb; | currentAlb = alb; | ||
Line 264: | Line 288: | ||
function go2left(){ | function go2left(){ | ||
var f = currentAlb; | var f = currentAlb; | ||
+ | finalize(); | ||
for(j=0;j<alb[f].length;j++){ if (garPic.src == alb[f][j].src) break;} | for(j=0;j<alb[f].length;j++){ if (garPic.src == alb[f][j].src) break;} | ||
if(j == 0) { | if(j == 0) { | ||
Line 276: | Line 301: | ||
else{ | else{ | ||
garPic.src = alb[f][j-1].src; | garPic.src = alb[f][j-1].src; | ||
+ | adjustSize(); | ||
description.innerHTML = alb[f][j-1].txt;} | description.innerHTML = alb[f][j-1].txt;} | ||
- | + | ||
} | } | ||
+ | |||
function go2right(){ | function go2right(){ | ||
var f = currentAlb; | var f = currentAlb; | ||
+ | finalize(); | ||
for(j=0;j<alb[f].length;j++){ if (garPic.src == alb[f][j].src) break;} | for(j=0;j<alb[f].length;j++){ if (garPic.src == alb[f][j].src) break;} | ||
if(j == alb[f].length - 1) { | if(j == alb[f].length - 1) { | ||
Line 297: | Line 325: | ||
} | } | ||
else{ | else{ | ||
- | + | ||
- | + | garPic.src = alb[f][j+1].src; | |
- | + | adjustSize(); | |
+ | description.innerHTML = alb[f][j+1].txt;} | ||
+ | |||
} | } | ||
+ | |||
+ | |||
</script> | </script> | ||
</html> | </html> |
Revision as of 14:40, 12 September 2013