timeout - Trying to write javascript function to animate scrollTo method -


i new javascript , know if following function should create transition scrolling down set scroll position , if not, misunderstanding time out or scroll methods..

    function scrolldowntomovie() {     (var scrollbit = 10; scrollbit < 900; scrollbit += 10) {                         window.settimeout(function({window.scrollto(0,scrollbit);}             ,scrollbit*100);              }     } 

thank you

try this. it's not perfect should want.

var scrollbit=10; function scrolldowntomovie() {          var time=settimeout(function(){scrolldowntomovie();},50); //fifty can whatever  increment want.          window.scrollto(0,scrollbit);scrollbit+=10;          if(scrollbit>890){cleartimeout(time);} } 

Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -