我在ajax无限滚动时遇到问题,浏览器中的后退按钮会将我返回到页面的上一个加载部分。如何使其返回到上一页?
$(document).ready(function() {
// Infinite Ajax Scroll configuration
jQuery.ias({
container : '.wrap', // main container where data goes to append
item: '.item', // single items
pagination: '.nav', // page navigation
next: '.nav a', // next page selector
loader: '<img src="css/ajax-loader.gif"/>', // loading gif
triggerPageThreshold: 3 // show load more if scroll more than this
});
});
这是导航:
<?php if (isset($next)): ?>
<div class="nav">
<a href='index.php?p=<?php echo $next?>'>Next</a>
</div>
<?php endif; ?>
现在,我应该为此使用"重写",因为它为我的url添加了一个新值,还是有其他解决方案?
代码来自此页面:链接
如果您使用的是GitHub版本,那么只需禁用分页和历史插件。如果您使用的是w3bees版本,那么在默认值列表中,您会注意到历史条目:
e.ias.defaults = {
container: "#container",
scrollContainer: e(window),
item: ".item",
pagination: "#pagination",
next: ".next",
noneleft: !1,
loader: '<img src="images/loader.gif"/>',
loaderDelay: 600,
triggerPageThreshold: 3,
trigger: "Load more items",
thresholdMargin: 0,
history: !0,
onPageChange: function() {},
beforePageChange: function() {},
onLoadItems: function() {},
onRenderComplete: function() {},
customLoaderProc: !1,
customTriggerProc: !1
只要将其值更改为history: 0;
,您就可以了。