1
这里是我的代码:jQuery的砌体和无限滚动
var $container = jQuery('#hentry-wrapper');
$container.imagesLoaded(function(){
$container.masonry({
itemSelector : '.hentry',
columnWidth: 454,
gutterWidth: 30,
isResizable: true
});
});
$container.infinitescroll({
navSelector : '#nav-pagination',
nextSelector : '#nav-pagination .next',
itemSelector : '.hentry',
loading: {
finishedMsg: 'No more pages to load.',
img: 'http://i.imgur.com/6RMhx.gif'
}
},
// trigger Masonry as a callback
function(newElements) {
// hide new items while they are loading
var $newElems = jQuery(newElements).css({ opacity: 0 });
// ensure that images load before adding to masonry layout
$newElems.imagesLoaded(function(){
// show elems now they're ready
$newElems.animate({ opacity: 1 });
$container.masonry('appended', $newElems, true);
});
});
// kill scroll binding
jQuery(window).unbind('.infscr');
// hook up the manual click guy.
jQuery('#load-more').click(function(){
$container.infinitescroll('retrieve');
return false;
});
// remove the paginator when we're done.
jQuery(document).ajaxError(function(e,xhr,opt){
if (xhr.status == 404) jQuery('#load-more').remove();
});
的问题是,#负载更没有当我们做了删除。但这里很好http://www.infinite-scroll.com/trigger.html有什么问题?请帮忙吗?
我知道,我需要将其删除。 – 2012-07-17 12:30:36
当你生成html页面时,你知道你是否在最后,如果是这样,你不会在你的页面添加html元素“#load-more”。 – tekilatexee 2012-07-17 12:56:01