0

使用同位素产生砌体效应

当我加载页面并向下滚动时,为了添加更多项目,我正在使用行为方法 twitter,所以我基本上点击了更多,但第一次点击时,项目“落”在页面上,我不知道为什么- 之后它可以接受但第一次点击不是

这是我正在使用的完整代码

$(document).ready(function () {

//$(function() {

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

  // isotope
  $container.isotope({
    itemSelector: '.wish_wrap_indiv',
    animationEngine : "best-available",
    getSortData: {
            name: function($element) {
                return $element.data('name');
            },

            site: function($element) {
                return $element.data('site');
            },

            date_added: function($element) {
                return $element.data('date_added');
            }

        }
  });

  // trigger Isotope layout again after images have loaded
  $container.imagesLoaded( function() {
    $container.isotope('reLayout');
  });


  // filter items when filter link is clicked
    $('#options a').click(function(){
      var selector = $(this).attr('data-filter');
      $container.isotope({ filter: selector });
      return false;
    });

    var $optionSets = $('#options .option-set'),
      $optionLinks = $optionSets.find('a');

    $optionLinks.click(function(){
    var $this = $(this);
    // don't proceed if already selected
    if ( $this.hasClass('selected') ) {
      return false;
    }
    var $optionSet = $this.parents('.option-set');
    $optionSet.find('.selected').removeClass('selected');
    $this.addClass('selected');

    });

  // infinite scroll
  $container.infinitescroll({
    navSelector  : "#page_nav",
                 // selector for the paged navigation (it will be hidden)
  nextSelector : "#page_nav a",
                 // selector for the NEXT link (to page 2)
  itemSelector : ".wish_wrap_indiv",
                 // selector for all items you'll retrieve
  behavior: "twitter",

  loading : {
            'finishedMsg' : 'No more wishes to load.',
            'img' : 'http://wishesandgifts.com/images_/icons/loading_sml.gif',
            'selector' : '#wall'
        }
    },
    // call Isotope as a callback
    function(newElements) {
      var $newElems = $(newElements);
      $newElems.imagesLoaded(function(){
        $container.isotope('insert', $newElems );
      });
    }
  );



});

我正在使用$(document).ready(function () {但也尝试过$(function () {

我还尝试使用“附加”插入新项目,但结果仍然相同。

有任何想法吗?

4

1 回答 1

0

通过声明图像 W & H 修复

于 2012-12-02T02:03:48.763 回答