0 Replies Latest reply on May 20, 2015 10:22 PM by Departure

    Stop autoScrolling when user clicks or scrolls manually

    Departure Level 1

      Hi All,

       

      I want the user to be able to stop the autoScroll by clicking on stage or grabbing the scrollbar. The code works fine for clicks but not the manual scrolling. The same code works fine if I replace $("body") with any div created on stage. I insist to use $("body") because it allows me to have some fixed divs on stage. Also, the same code works fine on sym.$("#Stage") but then the scrollbar doesn't animate when stage does.  Any ideas?. Thanks

       

      $("body").css({

      height:2000,

      width:$(window).width(),

      overflowY: "scroll",

      overflowX:"hidden"

      });

       

      $("body").animate({scrollTop:2200},100000,"linear")

      $("body").bind("scroll mousedown DOMMouseScroll mousewheel keyup", function(e){

          if ( e.which > 0 || e.type === "mousedown" || e.type === "mousewheel"){

              $("body").stop(true,false);

          }

      });