Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 如何使用无限滚动重新加载脚本?_Jquery_Infinite Scroll - Fatal编程技术网

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

Jquery 如何使用无限滚动重新加载脚本?,jquery,infinite-scroll,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')

我正在使用以下脚本来等于我网站上浮动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');
});
当无限滚动获取新项目时,我很难弄清楚如何使用NewElements函数重新加载equalheight脚本。有可能吗?如果有,我应该在上面写些什么


非常感谢

不确定,但尝试添加相等高度“.gallery项”;在Cufon.refresh之后的匿名函数中;谢谢你,拉杰什!您的解决方案似乎会影响equalheight脚本,但影响方式不正确。DIV的高度是一样的,但是一半放在另一半的上面。
    $(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();
    });
});