OneBite.Dev - Coding blog in a bite size

Auto Scroll page in Javascript

Do you have a really long page that you wish will scroll down automatically using javascript? or do you want to make this as feature for your website visitor?

Here is the snippet using scrollBy() method in Javascript. You can try this out directly by opening “right click -> inspect tab -> console” and paste this on that tab

function pageScroll() {
    scrolldelay = setTimeout(pageScroll,100);


Feel free to play with the speed by change the number 100 there