Javascript 未显示动态添加到nanogallery2的项目

Javascript 未显示动态添加到nanogallery2的项目,javascript,image-gallery,nanogallery,Javascript,Image Gallery,Nanogallery,我正在使用nanogalley2在网页上显示一个厨房。此库中的项目从服务器获取并动态添加到库中。我根据官方网站提供的信息添加项目。但是,动态添加的项目不会显示(在级联布局中)。我调试了chrome开发者工具中的代码,我看到项目被添加到了图库的项目列表中,但我不知道为什么这些项目没有显示出来 以下是我的HTML代码: <div id="my_nanogallery2" data-nanogallery2='{ "itemsBaseURL" : "https://exa

我正在使用nanogalley2在网页上显示一个厨房。此库中的项目从服务器获取并动态添加到库中。我根据官方网站提供的信息添加项目。但是,动态添加的项目不会显示(在级联布局中)。我调试了chrome开发者工具中的代码,我看到项目被添加到了图库的项目列表中,但我不知道为什么这些项目没有显示出来

以下是我的HTML代码:

<div id="my_nanogallery2"
    data-nanogallery2='{
        "itemsBaseURL" : "https://example.com",
        "thumbnailWidth" : 310,
        "thumbnailHeight" : "auto",
        "thumbnailDisplayTransition" : "slideUp",
        "thumbnailAlignment" : "center" 
    }'>nanogallery2
    <a href="my-first-image.jpg" data-ngthumb="my-first-image.jpg" data-ngdesc="">My First Image</a>
</div>    
<button type="button" id="btn_add">Load more ...</button>

thumbSet
方法需要每个缩略图的实际大小

但你使用的是画廊的尺寸定义。而且,不能使用值
auto

一种可能的解决办法是:

newItem.thumbSet(itemUrl, item.thumbnailWidth, item.thumbnailHeight);
newItem.thumbSet(itemUrl, item.thumbnailWidth, item.thumbnailHeight);