如何解决我的砌体无限制动新装入物品的问题。现在它将直接显示,没有平滑的动画:
function( newElements ) {
// hide new items while they are loading
var $newElems = $( newElements ).css({ opacity: 0 });
// ensure that images load before adding to masonry layout
$newElems.imagesLoaded(function(){
// show elems now they're ready
$newElems.animate({ opacity: 1 });
$container.masonry( 'appended', $newElems, true );
});
}
答案 0 :(得分:0)
试试这个
function( newElements ) {
// hide new items while they are loading
var $newElems = $( newElements ).css({ opacity: 0 });
// ensure that images load before adding to masonry layout
$newElems.imagesLoaded(function(){
// show elems now they're ready
$newElems.css({ opacity: 1 });
$container.masonry( 'appended', $newElems, true );
});
}
或者这可能会有所改善。 (我假设你正在使用砖石3?)。
function( newElements ) {
// hide new items while they are loading
var $newElems = $( newElements ).hide();
// ensure that images load before adding to masonry layout
$newElems.imagesLoaded(function(){
// show elems now they're ready
$newElems.fadeIn();
$container.masonry( 'appended', $newElems, true );
});
}