Django 中的无限滚动
是否可以在向下滚动时实现 facebook 样式的内容加载?我想在电子商务网站中实现它。每个类别中的项目很多,类别页面变得太长。我可以实现页码,但我的客户希望我实现 Facebook 类型的加载。有什么我可以用的吗?该网站的其余部分已经建成。
我确实研究过 django-endless-pagination 但无法让它工作。有没有什么demo可以让我研究一下?
Is it possible to implement facebook style loading of content while scrolling down? I would like to implement it in an ecommerce site. There are a lot of items in each category and the category page becomes too long. I could implement page numbers but my client wants me to implement that facebook type of loading. Is there anything I can use? Rest of the site has already been built.
I did look into django-endless-pagination but was not able to get it to work. Is there any demo of it so that I can look into it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我们在 www.mymommemories.com 上使用 django 无限分页,没有太多问题。因为我们使用的是 html5media,所以我们必须添加一行来以一秒的延迟运行该函数。 (setTimeOut("html5media()", 1000)。在某些浏览器中无延迟地运行它会导致问题。如果您不使用 html5media,这不应该是一个问题。
模板代码的核心部分。
在视图中我们有下面处理ajax请求的
page_template不是整个页面,只是与“分页”相关的部分。
We used django endless pagination on www.mymommemories.com without too much problem. Because we were using html5media we did have to add a line to run that function with a one second delay. (setTimeOut("html5media()", 1000). Running it without the delay caused problems in some browsers. If your not using html5media, this should not be a concern however.
Core part of the template code.
In the view we have the following to handle the ajax request.
The page_template is not the whole page, just the portion related to the "paging".
我认为进行无限分页的最简单方法是使用 jQuery(使用 $.loads)。
您甚至不需要更改后端代码。
I thinks the easiest way to do endless pagination is use jQuery (use $.loads).
You even don't need change the back-end code.
http://www.infinite-scroll.com/infinite-scroll-jquery-插件/
也许看一下?
http://www.infinite-scroll.com/infinite-scroll-jquery-plugin/
Perhaps take a look at that?