如何使用无限滚动重新加载脚本?

时间:2014-02-24 11:11:42

标签: jquery infinite-scroll

我正在使用以下脚本来等于我网站上浮动div的高度:

equalheight = function (container) {

var currentTallest = 0,
    currentRowStart = 0,
    rowDivs = new Array(),
    $el,
    topPosition = 0;
$(container).each(function () {

    $el = $(this);
    $($el).height('auto')
    topPostion = $el.position().top;

    if (currentRowStart != topPostion) {
        for (currentDiv = 0; currentDiv < rowDivs.length; currentDiv++) {
            rowDivs[currentDiv].height(currentTallest);
        }
        rowDivs.length = 0; // empty the array
        currentRowStart = topPostion;
        currentTallest = $el.height();
        rowDivs.push($el);
    } else {
        rowDivs.push($el);
        currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest);
    }
    for (currentDiv = 0; currentDiv < rowDivs.length; currentDiv++) {
        rowDivs[currentDiv].height(currentTallest);
    }
});
}

$(window).load(function () {
equalheight('.gallery-item');
});


$(window).resize(function () {
equalheight('.gallery-item');
});

我也在使用Paul Irish的Infinite Scroll插件:

    $(function () {
    $('.container').infinitescroll({
        navSelector: '.navigation',
        nextSelector: '.navigation ul li.older a',
        itemSelector: '.event',
        bufferPx: 600,
        animate: true,
        loading: {
            finishedMsg: 'No more articles to load!',
            img: 'images/loader.gif',
            speed: 0
        }
    }, function (newElements) {
        Cufon.refresh();
    });
});

当Infinite Scroll获取新项目时,我很难弄清楚如何使用NewElements函数重新加载equalheight脚本。这是可能的,如果是的话,我应该在那里写什么?

非常感谢!

0 个答案:

没有答案