0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

javascript で自動スクロール

Last updated at Posted at 2021-07-02

javascript で自動スクロール

1秒後にディスプレイのリフレッシュレートに合わせて、ページ最下部までゆっくりとスクロールします。

i = 0;
var start = function () {
    scrollTo(0, i);
    // この数字を変更することにより、進み具合を変えれます。
    i = i + 5;
    if (window.pageYOffset >= document.documentElement.scrollHeight - document.documentElement.clientHeight) {
    }else{
        window.requestAnimationFrame(start);        
    }
};
window.setTimeout(start, 1000);
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?