3 Replies Latest reply on Nov 22, 2013 2:20 PM by batson3000

    Could some edit this code to function for vertical scrolling?

    eppel2013

      Hello,

       

      I am a know nothing.

       

      Read this discussion ... http://forums.adobe.com/message/5501696.

       

      Ume YOSHIOKA provided code to control animation playback direction by scroll direction.

      It is for horizontal scroll only.

       

      His example of it in action ... http://ciruelo.jp/js/edge/ws/windowScroll.html

       

      Very clever.

       

      Could some edit this code to function for vertical scrolling?

       

      I am a know nothing and do not know if I am asking too much.

      My attempts were failures.

       

      Code is

       

      var totalFrame = 6250;
      var stageWidth = 10000;
      var maxScrollLeft = stageWidth - $(window).width();
      var baseFrame = 250;  //for adjustment

      //control the main timeline pos by $(window).scrollLeft() pos.
      $(window).scroll(function (e) {
        var scrollLeft = $(window).scrollLeft();              // get scroll pos
        var n = totalFrame*scrollLeft/maxScrollLeft|0;        // calc frame index
        sym.stop(n+baseFrame*(1-scrollLeft/maxScrollLeft)|0); // adjustment & move frame
      });

       

      thank you