gpt4 book ai didi

javascript - jquery-ias 插件不适用于我的网站,加载更多项目不起作用

转载 作者:行者123 更新时间:2023-12-01 05:31:30 24 4
gpt4 key购买 nike

我将我的网站设置如下:

 <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 &rarr;</a>
<a href="2.html">3</a>
</li>
</ul>

关于javascript - jquery-ias 插件不适用于我的网站,加载更多项目不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37005100/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com