janpaepke / ScrollMagic

The javascript library for magical scroll interactions.
http://ScrollMagic.io
Other
14.88k stars 2.17k forks source link

Parallax Effect on a div #692

Open davy440 opened 7 years ago

davy440 commented 7 years ago

Hello, I have started learning ScrollMagic and currently going through a learning curve. Trying to implement a simple parallax effect in which a div moves faster than the rest of the content. Here's the jQuery code I am using-

jQuery(window).ready(function() {
    var controller  =   new ScrollMagic.Controller();
    var tween = new TimelineMax()
        .add([
            TweenMax.fromTo(".ih-mobile", 1, {scale: y: '600px'}, {top: '-100px', ease: Linear.easeNone})
        ]);
    var scene   =   new ScrollMagic.Scene({duration: '200%'})
    .setTween(tween)
    .addTo(controller);
});

The div starts to transition automatically. I am a complete beginner with ScrollMagic, so there may be some noob mistakes here.

Any help appreciated...

davy440 commented 7 years ago

An update... This code is actually not working...