PDA

View Full Version : optional animation



andycramb
3 Jul 2009, 2:43 AM
I am syncing an animation on a div that synchronises the animation on scrolling and on height.
The height animation is optional depending on a passed in config parameter(this.animateHeight).
I have this working in the code below but it looks cumbersome.
Is there a better way to achieve this?



if(this.animateHeight === true){

this.outerSlidesBox.syncFx().animate(
{
scroll: {to: [scrollAmount,0]}
},
this.fxDuration,
null,
'easeBoth',
'scroll'
).animate(
{
height: {to:el.getHeight()}
},
this.fxDuration,
null,
'easeOut',
'run'
);

}
else{
this.outerSlidesBox.animate(
{
scroll: {to: [scrollAmount,0]}
},
this.fxDuration,
null,
'easeBoth',
'scroll'
);

this.outerSlidesBox.setHeight(el.getHeight());
}

steffenk
6 Jul 2009, 12:55 AM
have a look at lightbox, it does the same.

andycramb
6 Jul 2009, 3:11 AM
Thanks will do