The Myth
The Myth

Reputation: 1218

Auto-Scroll Fast in JS

I have a HTML which is very long. I would like to auto-scroll the content on load. My requirements are:

  1. Go to top when page opened.
  2. Scroll to the utmost bottom.

Here's what I tried:

function pageScroll() {
  window.scrollBy(0,7000);
  scrolldelay = setTimeout('pageScroll()',1000);
}

This works well but I want it to be faster and also I would like a replacement of 7000.

Upvotes: 1

Views: 212

Answers (1)

WhiteToggled
WhiteToggled

Reputation: 98

These are the values which should work best in my opinion

function pageScroll() {
    window.scrollBy(0, 3060) //don't set a timeout function
}
pageScroll()

Upvotes: 1

Related Questions