簡體   English   中英

重復div,或者到達底部時跳回頁面頂部

[英]Repeat div, or jumping back to the top of the page when you reach the bottom

我正在嘗試制作一個無限的可移動窗口,就像谷歌地圖一樣。

http://mondieu-bureau.nu/bureau/

我已經使在更大的窗口中拖動成為可能,但我需要以某種方式在水平或垂直方向上進行無限滾動,最好是兩者兼而有之。 很像http://unfold.no/ ,當你到達底部時它會跳回頂部,但我真的不知道如何。 有任何想法嗎? 謝謝!

您可以嘗試添加以下內容:

$(window).scroll(function() {
   if($(window).scrollTop() + $(window).height() > $(document).height() - 1) {
       $(window).scrollTop(0);
   }
});

檢查這個小提琴

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM