Jquery Infinite Scroll上的选项问题

时间:2012-09-28 18:59:44

标签: jquery jquery-masonry infinite-scroll

我与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();
    });
  }
);

});

1 个答案:

答案 0 :(得分:1)

删除'80'bufferpx值周围的'',否则你将它作为字符串传递。此外,您可能希望查看on github here