-1

Is it possible with jQuery to scroll down (with animation, not instant) as long as a certain variable is (not) met?

Example:

  var scroll = 100;
  while (scroll > 0) {

   //Scrolldown code here()

    scroll--;

  }
Robert_mk
  • 1
  • 1

2 Answers2

0

you mean something like:

var i = 0;
while(i < 1000)
{
window.scrollTo(0, i);
i++;
}

The scrolling however will be instant since the loop loops almost instantly

Salmin Skenderovic
  • 1,204
  • 7
  • 19
0
jQuery(document).scroll(function() {
 var a = jQuery(this).scrollTop();
 while(a > 120 ){
     //dosomething;
 } 

}); 
felix91
  • 462
  • 3
  • 11