Infinite Scroll.js在滚动条上加载相同的产品,而不是下一页上的产品-BigCommerce问题? [英] Infinite Scroll.js loads same products on scroll, instead of products from next page - BigCommerce issue?

查看:149
本文介绍了Infinite Scroll.js在滚动条上加载相同的产品,而不是下一页上的产品-BigCommerce问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了以下链接中提到的相同代码,但是出于某种原因,出于某种原因,它仅加载(克隆)当前页面中的项目,而不加载下一页中的项目?有什么想法吗?

I tried the same code as mentioned in the link below, but for some reason on my end it loads (clones) only the items from the current page, not the ones from the next page ???? Any ideas why ?

如何将Infinite Scroll添加到BigCommerce类别页面

<ul class="productGrid" data-infinite-scroll='{ "path": ".pagination-link", "append": ".product", "history": false }'>
{{#each products}}
<li class="product">
    {{>components/products/card show_compare=../show_compare show_rating=../settings.show_product_rating theme_settings=../theme_settings customer=../customer}}
</li>
{{/each}}
</ul>


<script src="https://unpkg.com/infinite-scroll@3/dist/infinite-scroll.pkgd.js"></script> 

推荐答案

似乎所有分页链接都具有类.pagination-link,包括带编号的(1,2,3等).发生的情况是Infinite Scroll库正在使用该类捕获第一个元素,恰好是page = 1,因此这是要附加的第一页.

It looks like all pagination links have the class .pagination-link, including the numbered ones (1,2,3 etc). What's happening is that the Infinite Scroll library is grabbing the first element with that class, which happens to be page=1, so that's the first page that's being appended.

尝试将您的代码更新为此,以指定路径链接应为下一个"分页链接:

Try updating your code to this to specify that the path link should be the 'Next' pagination link:

<ul class="productGrid" data-infinite-scroll='{ "path": ".pagination-item--next .pagination-link", "append": ".product", "history": false }'>
    {{#each products}}
    <li class="product">
            {{>components/products/card settings=../settings show_compare=../show_compare show_rating=../settings.show_product_rating theme_settings=../theme_settings customer=../customer event=../event position=(add @index 1)}}
    </li>
    {{/each}}
</ul>

感谢大家注意,我会在您链接到的帖子上更新我以前的答案:)

Thanks for the heads up--I'll update my previous answer on the post you linked to :)

这篇关于Infinite Scroll.js在滚动条上加载相同的产品,而不是下一页上的产品-BigCommerce问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆