Automatically scroll jQuery vertically in div

Can anyone suggest a nice simple vertical jQuery script autoprocessor? one that does not swell, I just need to run it automatically and scroll 6 or more li into the div. I tried jquery.autoscroll.js but could not start it automatically.

 $.fn.autoscroll.defaults = { start: { step: 50, scroll: true, direction: "down", pauseOnHover: true }, delay: 5000, ffrw: { speed: "fast", step: 100 } }; 
+4
source share
4 answers
 var div = $('div.autoscrolling'); var scroller = setInterval(function(){ var pos = div.scrollTop(); div.scrollTop(++pos); }, 100)​ 

Working demo .

EDIT:

To stop scrolling when a div scrolls down, add the following check at the end above function() {} -

 if($(this).scrollTop() + $(this).innerHeight() >= this.scrollHeight) clearInterval(scroller); } 
+14
source

simpleScroll - cool plugin http://logicbox.net/jquery/simplyscroll/

+3
source

Robin's answer didn’t quite do the trick for me for several reasons, so the extended version of his approach was changed here:

 var div = $('.scrollbit'); $('.scrollbit').bind('scroll mousedown wheel DOMMouseScroll mousewheel keyup', function(evt) { if (evt.type === 'DOMMouseScroll' || evt.type === 'keyup' || evt.type === 'mousewheel') { } if (evt.originalEvent.detail < 0 || (evt.originalEvent.wheelDelta && evt.originalEvent.wheelDelta > 0)) { clearInterval(scrollbit); } if (evt.originalEvent.detail > 0 || (evt.originalEvent.wheelDelta && evt.originalEvent.wheelDelta < 0)) { clearInterval(scrollbit); } }); var scrollbit = setInterval(function(){ var pos = div.scrollTop(); if ((div.scrollTop() + div.innerHeight()) >= div[0].scrollHeight) { clearInterval(scrollbit); } div.scrollTop(pos + 1); }, 100); 

using anonymous user1248475 here:

Determine if a user scroll event was generated.

and this answer:

fooobar.com/questions/527885 / ...

Hope this is useful for those who want to solve the problem of automatically scrolling divs using jquery and stopping when scrolling user manually.

+1
source

Downloading autoscroll.js on github contains the wrong files when loading. If you are looking there, you can find them.

I did a working demo from the link below, which you can copy if you want.

autoscroll.js on github

my working autoscroll demo

0
source

All Articles