jquery - scroll down then up 2 time when page is loaded -


hi guys i'm looking jquery make page scroll bottom of page top 2 time, ( down,up,down,up) !:) have works 1 time , dont know how make twice!

<script> $(document).ready(function() {     $('html, body').animate({      scrolltop: $(document).height() - $(window).height() },     8000, function() {     $(this).animate({ scrolltop: 0 }, 4000);  }); }); </script> 

here go: demo

  var scrollcount=0;   var scroll=function(direction){     if(scrollcount<4){       var scrollto= (direction==='down') ? $(document).height() - $(window).height() : 0;       $('html, body').animate({          scrolltop: scrollto },         800);       settimeout(function(){         scrollcount++;         direction=(direction==='down') ? 'up' : 'down';         scroll(direction);        },850);     }   }   scroll('down'); 

for reason callback on animation didn't work: failed demo


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -