Team:Grenoble/script
From 2012.igem.org
(Difference between revisions)
m |
m |
||
Line 151: | Line 151: | ||
fadeAfter:400, | fadeAfter:400, | ||
fadeOptions:{duration:1000,frameRate:25} | fadeOptions:{duration:1000,frameRate:25} | ||
- | } | + | }, |
- | + | redim:function(){ | |
+ | var c=q,a,b,d=w(),e,f,j,k,l,i,g,h,m,n; | ||
+ | a=c.img;f=j=k=l=''; | ||
+ | b=c.opt; | ||
+ | i=a.fileDim; | ||
+ | if(i){ | ||
+ | if(b.mode=='full'){ | ||
+ | g=m=d.w; | ||
+ | h=n=d.h; | ||
+ | if(!b.enlarge){ | ||
+ | if(g>i.w){ | ||
+ | g=m=i.w | ||
+ | } | ||
+ | if(h>i.h){ | ||
+ | h=n=i.h | ||
+ | } | ||
+ | } | ||
+ | if(!b.reduce){ | ||
+ | if(m<i.w){ | ||
+ | m=i.w; | ||
+ | g=Math.max(m,g) | ||
+ | } | ||
+ | if(n<i.h){ | ||
+ | n=i.h; | ||
+ | h=Math.max(n,h) | ||
+ | } | ||
+ | } | ||
+ | }else{ | ||
+ | m=g=d.w; | ||
+ | n=h=0; | ||
+ | if(!b.reduce){ | ||
+ | g=0 | ||
+ | } | ||
+ | } | ||
+ | i=A(i.w,i.h,{min_w:m,win_h:n,max_w:g,max_h:h,round:1}); | ||
+ | a.width=i.w; | ||
+ | a.height=i.h; | ||
+ | if(!a.width){ | ||
+ | a.removeAttribute("width") | ||
+ | } | ||
+ | if(!a.height){ | ||
+ | a.removeAttribute("height") | ||
+ | } | ||
+ | switch(b.align){ | ||
+ | case'left':k='0px'; | ||
+ | break; | ||
+ | case'right':l='0px'; | ||
+ | break; | ||
+ | default:k=-Math.round((i.w-d.w)/2)+'px' | ||
+ | } | ||
+ | if(b.vertAlign=='bottom'){ | ||
+ | j='0px' | ||
+ | }else if(b.vertAlign=='middle'){ | ||
+ | e=b.position=="fixed"?d.h:x().h; | ||
+ | f=(-b.ffHack+(e-a.offsetHeight)/2)+"px" | ||
+ | }else{ | ||
+ | f=a.hack||'0px' | ||
+ | } | ||
+ | s(a,{left:k,right:l,top:f,bottom:j}) | ||
+ | } | ||
+ | } | ||
+ | |||
+ | }; | ||
+ | r.bgMax=q | ||
}) | }) | ||
(window,document); | (window,document); |
Revision as of 11:52, 12 July 2012