我与Jquery Masonry一起使用无限滚动。一切都很好,除了我无法获得任何无限滚动的选项。我正在尝试更改加载文本,添加一个bufferpx。文档说你可以这样做,我已经完全按照它,但我的网站上没有任何变化。这就是我所拥有的:
$(function(){
var $container = $('#loop-wrapper');
$container.imagesLoaded(function(){
$container.masonry({
itemSelector: '.hentry'
});
});
$container.infinitescroll({
animate : true,
navSelector : '.navigation-links', // selector for the paged navigation
nextSelector : '.navigation-links a:first-of-type', // selector for the NEXT link (to page 2)
itemSelector : '.hentry', // selector for all items you'll retrieve
loadingText : 'test',
bufferpx : '80',
loading: {
finishedMsg: 'Thats the end of this gallery.',
img: 'http://ryanswansondesign.com/wp-content/themes/ryan/images/ajax-loader.gif',
}
},
// trigger Masonry as a callback
function( newElements ) {
// hide new items while they are loading
var $newElems = $(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 );
hoverForTitles();
});
}
);
});