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?
Code:
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());
}