1

我有一个页面,其中有几个链接,单击这些链接时,会将图像库加载到 Nyromodal 灯箱内的 Galleria 中。当灯箱关闭时,我使用 $("#container").html('') 清除灯箱的内容,包括 Galleria。

// open modal
$.nmManual("#container",{
    callbacks: {
        // loads Galleria after lightbox has finished opening
        afterReposition: function(nm) {
            $("#container #gallery").galleria({
                width:800,height:600
            });
        },
        // clear container with Galleria before closing the Modal
        beforeClose: function(nm) {
            $("#container").html('');
        }
    }
})

我正确打开的下一个链接打开了一个 Nyromodal 灯箱,使用一组新图像正确填充 Galleria,但使用的是 Galleria 的另一个实例。我想删除所有旧的 Galleria 实例。我该怎么做呢?我在文档中看不到任何允许我手动删除实例的内容。

我知道我使用 Galleria.get() 创建了多个 Galleria 实例。这确实与 Nyromodal 没有太大关系,但有些上下文总是好的 :)

同样的问题:http: //getsatisfaction.com/galleria/topics/allow_ability_to_remove_galleria_instances (代码不适用于当前版本)

谢谢!

4

1 回答 1

1

您可以简单地重用现有的 Galleria 实例,就像这样

var gal;

if (!gal) {                 // not created yet
    $('#galleria2').galleria({
        dataSource: [],
        lightbox: true,
        some other options....
    });
    gal = $('#galleria2').data('galleria');
}
gal.load(images);
于 2011-12-02T14:29:43.443 回答