Quantcast
Channel: Adobe Community : All Content - Edge Animate
Viewing all articles
Browse latest Browse all 9897

Parallax Scrolling with Vertical ScrollBar : SOLVED

$
0
0

I am pissed because no support and no reply to my problem thread http://forums.adobe.com/thread/1290045 from adobe and its community staff on the forum.

 

I made the code for parallax scrolling for vertical sidebar. Hopefully usefull for most of the users.

 

 

Here is the code :

 

 

Just create your animation with autoplay off and put the below code in the composition ready for stage :

 

$(window).scroll(function(e){

        var scrollTop = $(window).scrollTop();

        var docHeight = $(document).height();

        var winHeight = $(window).height();

        var scrollPercent = (scrollTop) / (docHeight - winHeight);

        var percentageScrolled = (scrollPercent*100)/100;

        var pos = Math.round(percentageScrolled*sym.getDuration());

      sym.stop(pos)

});

 

 

 

Second: Coding is to play the timeline after scrolling 200 and reverse play if scroll bar is moved up. and Put this code if you want to play your timeline after some scrolling. First do Autoplay off and put the below code in the composition ready for stage.

 

var oldPos, newPos;

$(window).scroll(function () {

newPos = $(window).scrollTop();

if(!oldPos){

        oldPos = 0;

};

if( newPos >= 200 && oldPos < 200){

   //plays the timeline after vertical scrolling 200

    sym.play();

    oldPos = newPos;

  }else{

          //reverse play if vertical scrollbar is less than 200

          if(newPos < 200 && newPos < oldPos && oldPos > 200){

            sym.playReverse();

            oldPos = newPos;

       }

   };

})


Viewing all articles
Browse latest Browse all 9897

Trending Articles