开发者

Timed scrolling in javascript

开发者 https://www.devze.com 2023-02-12 02:19 出处:网络
I need a script开发者_如何学Go that scrolls automatically throught my page without buttons,I want it to scroll down every 10 seconds and then return to the top when done,how would i do this in javascr

I need a script开发者_如何学Go that scrolls automatically throught my page without buttons,I want it to scroll down every 10 seconds and then return to the top when done,how would i do this in javascript?

Thanks, Lee


You want to use a combination of the jquery scrollTo() plugin and the javascript setTimeout() function. You would do something like (pseudocode):

setTimeout(scrollMyPage, 10000)
{
    if (At bottom of the page)
    {
        scroll To Top
    }
    else
    {
        scroll down the height of the browser window/a page
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号