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.
this does work with ScrollMagic. :)
check it out. -> http://janpaepke.github.io/ScrollMagic/
regards,
J