-1

私はjquery-masonryを使用するワードプレスのテーマを作成中ですが、私の人生ではisAnimatedFromBottomでappendメソッドを使用する方法がわかりません。以下は、私が現在使用しているコードです。これをジェットパックの無限スクロールで機能させようとしています。

洞察や助けをいただければ幸いです。

jQuery(document).ready(function($) {
var $container = $('#content');

$container.imagesLoaded(function(){
    $container.masonry({
        itemSelector: '.post',
        isAnimated: true,
        animationOptions: {
            duration: 300,
            easing: 'linear',
            queue: false
        }
    });
});

});

4

1 に答える 1

0

新しい要素を左上隅ではなく下部に表示してから所定の位置に移動する場合。追加されたメソッドには isAnimatedFromBottom フラグを使用する必要があります。例えば

var isAnimatedFromBottom = true;
.masonry( 'appended', $content, isAnimatedFromBottom );

以下のコードは、infinitescroll の例です。

$container.infinitescroll({
  navSelector  : '#page-nav',    // selector for the paged navigation 
  nextSelector : '#page-nav a',  // selector for the NEXT link (to page 2)
  itemSelector : '.box',     // 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 ) {
    var $newElems = $( newElements );
    // ensure that images load before adding to masonry layout
    $newElems.imagesLoaded(function(){
      $container.masonry( 'appended', $newElems, true ); 
    });
  }
);
于 2013-04-27T03:23:15.690 に答える