Percentage units for tween position values #145

Closed
lloydh opened this Issue Feb 2, 2014 · 2 comments

Projects

None yet

2 participants

@lloydh
lloydh commented Feb 2, 2014

Is it possible to specify to/from position values in percentages rather than the default unit-less (pixel) values?

I have tried this without any success:
TweenMax.fromTo($('#example'), 1, {css:{top: 70%}, immediateRender:true}, {css:{top: 5%}})

Thanks.

@janpaepke
Collaborator

Yes, but percent values need quotation marks. The correct Syntax is:

TweenMax.fromTo($('#example'), 1, {css:{top: "70%"}}, {css:{top: "5%"}});

Note that i left out the immediateRender part, because fromTo always sets immediateRender to true.
By the way: with the current version of tweenmax you can even omit the "css" part.
So this should also work:

TweenMax.fromTo($('#example'), 1, {top: "70%"}, {top: "5%"});

But this is clearly a tweenMax, not a Superscrollorama issue :)

regards,
J

@janpaepke janpaepke closed this Feb 2, 2014
@janpaepke janpaepke was assigned Feb 2, 2014
@lloydh
lloydh commented Feb 2, 2014

Fantastic, thanks for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment