我把我的网站设置成这样:
<div id="posts" class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
<div class="post post-preview">
<a href="post.html">
<h2 class="post-title">
Visualization Data Art
</h2>
<h3 class="post-subtitle">
How to make sense of big data
</h3>
</a>
<p class="post-meta">Posted by <a href="#">KP</a> on September 24, 2016</p>
</div>
<hr>
<div class="post post-preview">
<a href="3.html">
<h2 class="post-title">
About this blog
</h2>
</a>
<p class="post-meta">Posted by <a href="about.html">KP</a> on September 18, 2016</p>
</div>
<hr>
</div>
<div id="pagination">
<a href="2.html">1</a>
<a href="3.html" class="next">2</a>
</div>
我的javascript是:
var ias = jQuery.ias({ container: '#posts', item: '.post', pagination: '#pagination', next:'.next ' });
当我尝试加载更多内容时,"旧帖子"按钮会消失,不会显示任何页面。我只尝试在网站上找到的基本示例。
我觉得分页不对。下面是文档Infinite AJAX Scroll docs,你可以看到".next"用于链接,而不是代码中的"li"。你在"li"标记和"a"标记上使用它。我认为这个插件的工作方式是在a标签上查找href,然后ajax调用它并获取内容,然后附加到容器DOM中。
<ul id="pagination" class="pager">
<li class="next">
<a href="2.html">1</a>
<a class="next" href="2.html">Older Posts →</a>
<a href="2.html">3</a>
</li>
</ul>