Team:Goettingen/Team/Gallery
From 2013.igem.org
(Difference between revisions)
Line 113: | Line 113: | ||
//显示图片框 | //显示图片框 | ||
showbox = document.createElement('div'); | showbox = document.createElement('div'); | ||
+ | showbox.id = 'showbox'; | ||
with(showbox.style){ | with(showbox.style){ | ||
position = 'relative'; | position = 'relative'; | ||
Line 248: | Line 249: | ||
if( garPic.height/garPic.width > adHeight/adWidth) {garPic.style.height = adHeight + 'px'; | if( garPic.height/garPic.width > adHeight/adWidth) {garPic.style.height = adHeight + 'px'; | ||
garPic.style.width = adHeight/ratio + '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; | showbox.style.width = garPic.style.width; | ||
prefoto.style.top = (garPic.height - prefoto.height)/2 + 'px'; | prefoto.style.top = (garPic.height - prefoto.height)/2 + 'px'; | ||
Line 265: | Line 265: | ||
garPic.style.marginLeft = ''; | garPic.style.marginLeft = ''; | ||
} | } | ||
+ | |||
+ | garPic.onload = function(){adjustSize()}; | ||
function showGarPic(from,illustration,alb){ | function showGarPic(from,illustration,alb){ | ||
+ | finalize(); | ||
currentAlb = alb; | currentAlb = alb; | ||
garPic.src = from; | garPic.src = from; | ||
Line 288: | Line 291: | ||
nextfoto.style.top = (garPic.height - prefoto.height)/2 + 'px'; | nextfoto.style.top = (garPic.height - prefoto.height)/2 + 'px'; | ||
},100); | },100); | ||
+ | document.body.insertBefore(lightframe,document.body.childNodes[0]); | ||
} | } | ||
Line 293: | Line 297: | ||
function go2left(){ | function go2left(){ | ||
var f = currentAlb; | var f = currentAlb; | ||
- | |||
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 305: | Line 308: | ||
}; }} | }; }} | ||
else{ | else{ | ||
- | + | $('#showbox').fadeOut(300,function(){ | |
- | + | garPic.src = alb[f][j-1].src; | |
- | + | description.innerHTML = alb[f][j-1].txt; | |
+ | finalize(); | ||
+ | $('#showbox').fadeIn(300); | ||
+ | |||
+ | |||
+ | }); | ||
+ | |||
+ | } | ||
} | } | ||
- | + | function loading(){ | |
+ | ohteralb.innerHTML = 'Loading'; | ||
+ | lightframe.insertBefore(otheralb,showbox); | ||
+ | } | ||
function go2right(){ | function go2right(){ | ||
var f = currentAlb; | var f = currentAlb; | ||
- | + | ||
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 330: | Line 343: | ||
} | } | ||
else{ | else{ | ||
+ | $('#showbox').fadeOut(300,function(){ | ||
+ | garPic.src = alb[f][j+1].src; | ||
+ | description.innerHTML = alb[f][j+1].txt; | ||
+ | finalize(); | ||
+ | $('#showbox').fadeIn(300); | ||
- | + | ||
- | + | }); | |
- | + | ||
- | + | } | |
+ | |||
} | } | ||
- | |||
</script> | </script> | ||
</html> | </html> |
Revision as of 10:36, 15 September 2013