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
Post a Comment