0

我创建了一个颜色框,它工作正常。问题是,当我关闭它并在页面上打开一个不同的颜色框时,两个颜色框都会加载(第一个直接在第二个后面)。当我关闭它们并打开另一个时,我会得到三个颜色框,等等。

我在 Drupal 7 视图中执行此操作,我正在向所有图像字段添加颜色框链接。

我调用颜色框的代码:

$('.views-field-field-gallery-images .field-content img').each(function() {

    nid = $(this).parent().parent().parent().find('.views-field-nid .field-content').html();
    href = $(this).attr('href');
    //$(this).attr('href', 'gallery-slideshow/' + nid +'?width=500&height=500&iframe=true');
    href = 'gallery-slideshow/' + nid;
    $(this).colorbox({href: href});
    //$(this).attr('href', 'http://www.cnn.com?width=500&height=500&iframe=true');
    //$(this).addClass('colorbox-load init-colorbox-load-processed cboxElement');
});
4

1 回答 1

0

在你的颜色框中使用它:

var x = $(this).colorbox({onClosed: function(){ x.remove(); }});
于 2013-08-29T23:06:15.237 回答