当我们完成演示时,我需要删除分页器 http://www.infinite-scroll.com/trigger.html
// remove the paginator when we're done.
$(document).ajaxError(function(e,xhr,opt){
if (xhr.status == 404) $('a#next').remove();
});
但是这段代码不起作用。我在演示中提到过 Infinite Scroll 的版本是 1.5.100504,但我在这里下载的最新版本是 2.0b2.110713 那么,有什么帮助吗?
也许这可以帮助我:
state: { isDuringAjax: false, isInvalidPage: false, isDestroyed: false, isDone: false, // For when it goes all the way through the archive. isPaused: false, currPage: 1 },
?
最佳答案
您的网站永远不会发回 404 http 状态代码,因此此行永远不会起作用:
if (xhr.status == 404) jQuery('#load-more').find('.text').html('No more posts to load.').end().delay(2000).fadeOut();
“没有更多帖子要加载”消息来自无限滚动初始化的“finishedMsg”属性。
如果你要添加
finished: function() {
if (this.options.state.isDone) {
$('#load-more').remove();
}
},
配置的加载属性:
$container.infinitescroll({
navSelector: '#nav-pagination-load-more',
nextSelector: '#nav-pagination-load-more .next',
itemSelector: '.hentry',
loading: {
selector: '#load-more',
finishedMsg: 'No more posts to load.',
img: 'http://cdn.moozpaper.com/lucidpress/wp-content/themes/lucidpress/images/loading_small.gif',
// like so: ==============================
finished: function() {
if (this.options.state.isDone) {
$('#load-more').remove();
}
},
msgText: ''
},
behavior: 'local'
},
它应该可以满足您的需要。但这很难说,因为这个版本的插件没有很好的文档记录。
关于jquery - 无限滚动 完成后删除分页器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11566862/