【问题标题】:Lightbox behaviour on appeded or cloned content附加或克隆内容的灯箱行为
【发布时间】:2013-02-10 11:38:00
【问题描述】:

我真的需要一些帮助!

我在 Joomla 的后端工作。您可能知道 Joomla 默认使用 Mootools,它是默认的 SqueezeBox 灯箱。 我正在尝试构建一个模块,并在其中构建一个自定义字段,在其中添加附加或克隆的行。为此,我使用了 Jquery DynoTable.js 插件。

问题是在每一行里面都有一个链接,它调用了一个模态灯箱 iframe。当我添加新行时,新行无法打开灯箱。

window.addEvent('domready', function() {
SqueezeBox.initialize({});
SqueezeBox.assign($$('a.modal'), {
    parse: 'rel'
});

});

不幸的是,我无法更改此脚本,它位于 Joomla 的核心内部并且不想触摸它。

我猜这是因为已经设置的触发器在 domReady 上,并且仅适用于已经存在的 Dom。为此,我尝试向 DynoTable 脚本添加一个后备“触发器”,该脚本正在调用 Squeezebox 灯箱以再次应用:

onRowAdd: function(){
SqueezeBox.assign($$("a.modal"), {parse: "rel"}); 

},

这可行(将打开灯箱),但是已经设置的模式链接(来自加载的行)将在该模式中打开 2、3、4 等 iframe,具体取决于添加了多少新行。所以基本上新行将打开一个普通的灯箱,而旧行将在该灯箱中打开多个 iframe。

希望我解释清楚.. 非常感谢你们!!

【问题讨论】:

    标签: jquery joomla mootools append squeezebox


    【解决方案1】:

    尝试将您的分配选择器更改为如下内容:

    onRowAdd: function(){
       // YOURDYNTABLE_ID has to be a valid selector to specify the dynoTable, can 
       // be an ID or class of the table, or an parent element containing the table
       // with tr:last-child you only select the last row (the one you just added).
       SqueezeBox.assign($$("YOURDYNTABLE_ID tr:last-child a.modal"), {parse: "rel"}); 
    }
    

    【讨论】:

    • 阿克塞尔万岁!!非常感谢,我不知道我还没有想到什么!! :D
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-30
    • 1970-01-01
    • 2010-10-17
    • 2018-05-15
    相关资源
    最近更新 更多