質問

Trying to animate a pic on scroll using superscrollorama! My issue is when I scroll back to the top, it doesn't work! The code I'm using is:

<script>
$(document).ready(function() {
var controller = $.superscrollorama();
// individual element tween examples
 controller.addTween('#logo_3', TweenMax.fromTo( $('#logo_3'), .8, {css:{opacity:1,       top:'50px'}, immediateRender:true, ease:Quad.easeInOut}, {css:{opacity:0.5, top:'400px'}, ease:Quad.easeInOut}));

controller.addTween('#logo_2', TweenMax.fromTo( $('#logo_2'), 1, {css:{opacity:0.5, top:'0px'}, immediateRender:false, ease:Quad.easeInOut}, {css:{opacity:1, top:'600px'}, ease:Quad.easeInOut}));
        });
</script>

any idea? thanks in advance!

役に立ちましたか?

解決

i got the same issue , i fixed it by giving pixel instead to div

instead of

 controller.addTween('#logo_3', TweenMax.fromTo( $('#logo_3')

use pixel where tween will fire like

 controller.addTween(10, TweenMax.fromTo( $('#logo_3')

10 is the pixel when tween will fire

他のヒント

So the good news is I know what the problem is, I found a bug in superscrollorama that when animations happens at 0 pixels may not always reverse correctly because of a line of code problem.

https://github.com/johnpolacek/superscrollorama/pull/105

Is my suggested fix for the issue. Specifically my issue was happening with pins but I see other places where this could happen with other animations. This boils down to a < vs <= on 0 pixel items. So be glad it isn't your fault but my proposed fix is still in discussion.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top