Jquery 如何使用无限滚动重新加载脚本?
我正在使用以下脚本来等于我网站上浮动div的高度: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')
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();
});
});