砌体无限滚动动画不流畅

时间:2014-10-11 21:29:37

标签: jquery

如何解决我的砌体无限制动新装入物品的问题。现在它将直接显示,没有平滑的动画:

  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 );
    });
  }

1 个答案:

答案 0 :(得分:0)

试试这个

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.css({ opacity: 1 });

  $container.masonry( 'appended', $newElems, true );
});
}

或者这可能会有所改善。 (我假设你正在使用砖石3?)。

function( newElements ) {
// hide new items while they are loading
var $newElems = $( newElements ).hide(); 
// ensure that images load before adding to masonry layout
$newElems.imagesLoaded(function(){
  // show elems now they're ready
  $newElems.fadeIn(); 
  $container.masonry( 'appended', $newElems, true );
});
 }