Benjamin Allison
Benjamin Allison

Reputation: 2154

Dynamically binding/unbinding SuperScrollorama tweens

I'm trying to bind/unbind SuperScrollorama tweens dynmaically. On unbind, I also need to reset the tweened element to its default styles. In my case, I'm the bind/unbind needs to happen, based on browser width. I thought I could do something like this:

calcSizes = function() {
    controller.addTween( '#panel', TweenMax.to( $('#panel h1'), .5, {css:{top: 0 }}), 0, 50);
    if ( viewport().width >= '720' ) {
        controller.removeTween( '#panel' );
    }
}

$(window).resize(function(){
    calcSizes();
});

Of course, this isn't particularly elegant, and doesn't work.

Upvotes: 0

Views: 206

Answers (1)

Jan Paepke
Jan Paepke

Reputation: 2027

this does work with ScrollMagic. :)
check it out. -> http://janpaepke.github.io/ScrollMagic/

regards,
J

Upvotes: 1

Related Questions