使用javascript的无限滚动效果

问题描述:

有人知道如何制作这样的滚动效果吗? http://www.eurekasoft.com

anyone have a clue how to make a sroll effect like this? http://www.eurekasoft.com

我知道内容会在结尾处重复以创建错觉,但我想知道如何实现看似永无止境的滚动.

I know the content is repeated at the end to create the illusion but i would like to know how to achieve the seemingly never end scroll.

谢谢!

这对我有用:)

这里是示例: http://www.cancerbero.mx (仅在Chrome和Safari中启用)

here is the example: http://www.cancerbero.mx (only enable in Chrome and Safari)

// #loop is the div ID where repetition begins

$(document).ready(function(){
            $(window).scroll(function(){
                var scroll = $(window).scrollTop();
                var limit = $('#loop').position().top;
                if(scroll >= limit){
                    window.scrollTo(0,1); // 1 to avoid conflicts
                }
                if(scroll == 0){
                  window.scrollTo(0,limit);  
                }
            });
        });