Continuous Looping Page (Not Infinite Scroll)

前端 未结 6 1390
忘掉有多难
忘掉有多难 2020-12-02 21:16

I\'m looking for resources that create scrolling functions like the ones found on these sites:
Outpost Journal
Unfold

Once the scroll bar hits the bottom

6条回答
  •  Happy的楠姐
    2020-12-02 22:12

    if you want infinite scroll in both directions use

    if (document.documentElement.clientHeight + $(window).scrollTop() >= $(document).height()) {
        $(document).scrollTop(0)
    } else if ($(window).scrollTop() < 0) {
        $(document).scrollTop($(document).height())
    }
    

    (I know it's a late reply but it still helps users like me who just google stuff like this)

提交回复
热议问题