【问题标题】:lazy scroll till the page ends, then show next page懒惰滚动直到页面结束,然后显示下一页
【发布时间】:2013-05-29 23:23:12
【问题描述】:

我正在使用 django-endless-pagination 来加载我的对象。它工作正常,但我想在滚动时加载一些页面,然后在这些页面之后,我想要一个“显示更多”,当点击时加载下一组页面(再次滚动)

如果我使用

<script>$.endlessPaginate();</script> 

{% lazy_paginate 100 entries %} 

我希望这些条目会延迟加载,但事实并非如此,它们一次只加载全部 100 个。另外,我不能使用类似的东西

<script>
    $.endlessPaginate({
        paginateOnScroll: true,
        paginateOnScrollMargin: 20
    });  </script>

因为这会在滚动时加载所有页面,而不是一组页面。

这就是我想做的:http://www.flipkart.com/mens-clothing/trousers/pr?sid=2oq%2Cs9b%2C9uj&otracker=hp_submenu_clothing_Trousers&_pop=flyout 在这里,当我们滚动时,每个页面都会被加载,在 20 页之后,有一个“显示更多页面”,它会在滚动时加载第 21 页和其他页面,依此类推。

对此的任何帮助都会很棒!谢谢。

【问题讨论】:

    标签: django django-endless-pagination


    【解决方案1】:

    首先,如果您使用{% lazy_paginate 100 entries %},您得到的行为是正确的:您要求在每页上输入 100 个条目。

    在此处阅读文档:http://django-endless-pagination.readthedocs.org/en/latest/templatetags_reference.html#paginate

    至于第二部分:是的,您可以在一定数量的页面后显示“显示更多”链接: http://django-endless-pagination.readthedocs.org/en/latest/javascript.html#on-scroll-pagination-using-chunks

    此外,你可能想用

    编写js调用
       $(document).ready(function() {
           $.endlessPaginate();
       });
    

    【讨论】:

      猜你喜欢
      • 2017-08-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多