Javascript 砌体初始化前停止显示项目

Javascript 砌体初始化前停止显示项目,javascript,jquery,jquery-masonry,Javascript,Jquery,Jquery Masonry,我试图将砖石元素附加到现有元素上 然而,我目前拥有的是——在砖石结构初始化之前显示的项目,然后在第二秒后跳入位置。我想把它们藏起来,直到它们就位 这是一个无限滚动插件中的代码,我正在使用该插件附加砖石项目: $container.append(data); $container.imagesLoaded( function() { $container.masonry('reloadItems').masonry(); }); 在这里,它被初始化: $(document).ready(

我试图将砖石元素附加到现有元素上

然而,我目前拥有的是——在砖石结构初始化之前显示的项目,然后在第二秒后跳入位置。我想把它们藏起来,直到它们就位

这是一个无限滚动插件中的代码,我正在使用该插件附加砖石项目:

$container.append(data);
$container.imagesLoaded( function()
{
    $container.masonry('reloadItems').masonry();
});
在这里,它被初始化:

$(document).ready(function ()
{
    $container = $('#container');
    // initialize the masonry instance
    $container.imagesLoaded(function(){
        $container.masonry({
            columnWidth: 1,
            itemSelector: '.item',
            transitionDuration: 0
        });
    });

    $('#container').scrollPagination({

        nop     : 36, // The number of posts per scroll to be loaded
        offset  : 0, // Initial offset, begins at 0 in this case
        error   : 'No More Posts!', // When the user reaches the end this is the message that is
                                    // displayed. You can change this if you want.
        delay   : 500, // When you scroll down the posts will load after a delayed amount of time.
                       // This is mainly for usability concerns. You can alter this as you see fit
        scroll  : true // The main bit, if set to false posts will not load as the user scrolls. 
                       // but will still load if the user clicks.   
    });
});
更新

根据Josh的回答,我的代码如下所示:

$container.append(data);
$container.imagesLoaded( function()
{
    $(".item").show();
    $container.masonry('reloadItems').masonry();
});
我已经添加到项目标签中


但是,当我刷新页面时,现在没有显示任何元素。

使用引导隐藏类集加载它们,并在运行后将其删除

如果砖石工程需要它们可见以进行计算,请在加载时将它们显示在屏幕外。Z指数、疯狂位置等

更新


因此,我快速浏览了一下这里的方法,如果没有我提到的这个技巧,我相信您可以使用ajax加载新项目,然后使用mashise.addItems items方法。

我的意思是让您隐藏新带到页面中的项目。你把一切都隐藏起来,这样就永远不会暴露出来。另外,执行$'.item'.removeClass'hide';相反,这是我面临的问题——我如何仅指新项目而不是简单地指每个项目?