gpt4 book ai didi

javascript - 如何刷新 NanoGallery jQuery 插件中的内容?

转载 作者:行者123 更新时间:2023-12-02 14:01:46 25 4
gpt4 key购买 nike

我希望能够在按下按钮时从我的 div 中删除专辑内容。像 $("#myDiv").html("") 之类的东西,所以画廊从 DOM 中删除,然后我可以在同一个 div 中重新创建画廊,但在单击另一个按钮时使用不同的数据源数组。

现在我有一个创建 nanoGallery 的函数,当用户单击一个按钮时我调用它,然后当用户单击另一个按钮时我需要删除 nanoGallery 并使用不同的数据重新创建它。

现在不起作用的代码:

function createAlbum()
{
// This object has a different array every time button is clicked!
var pics = currentOrder["vehicle-pictures"];

$("#repairPictures").nanoGallery({
items : pics,
colorSchemeViewer : 'light',
photoset : 'none',
viewerDisplayLogo : true,
thumbnailLazyLoad : true,
thumbnailLabel : { display: true, position: 'overImageOnBottom', titleMaxLength: 35 },
colorScheme : { thumbnail:{ labelBackground: '#444 !important' } },
locationHash : false,
thumbnailHoverEffect :'borderLighter,imageScaleIn80'
});
}

然后将其删除...

//---------------------------------------------------------------------
function cleanAlbum()
{
$("#repairPictures").html("");
}

我怎样才能做到这一点?

顺便说一句, $("#myDiv").html("") 方法只是一个示例,如果您知道从 div 中删除画廊 html 的更好方法,请随时提出建议。

最佳答案

如果您想从 DOM 中删除相册,请使用:$('#yourElement').nanoGallery('destroy');,但您可以为 nanoGallery 设置新项目,只需执行 $('#yourElement').nanoGallery('reload');

关于javascript - 如何刷新 NanoGallery jQuery 插件中的内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40369525/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com