1

我尝试过用砖石进行无限滚动,当我尝试在我的网站中实现时,它不起作用。有人可以帮我吗?当我尝试在空白页上执行此操作时,它正在工作。

我不知道是否必须有一些 CSS 规则或类似的东西。

感谢您的任何建议。

现场演示: http: //www.marygate.cz/beta

第二页应该是http://www.marygate.cz/beta/1.html

我的 JavaScript 代码:

var $container = $('#content');

$container.imagesLoaded(function(){
  $container.masonry({
    itemSelector: '.produkt',
    columnWidth: 275
  });
});

$container.infinitescroll({
  navSelector  : '#page-nav',    // selector for the paged navigation 
  nextSelector : '#page-nav a',  // selector for the NEXT link (to page 2)
  itemSelector : '.produkt',     // selector for all items you'll retrieve
  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 = $( 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 ); 
    });
  }
);

});
4

0 回答 0