【问题标题】:Colorbox loads all previous colorboxes颜色框加载所有以前的颜色框
【发布时间】:2013-08-29 21:09:17
【问题描述】:

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

我在 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');
});

【问题讨论】:

  • 您能否描述一下为什么使用此代码?您可以在视图本身中重写输出以打开此颜色框。请写下您需要的功能。然后我可能会帮助您获得所需的结果。

标签: jquery drupal drupal-7 colorbox


【解决方案1】:

在你的颜色框中使用它:

var x = $(this).colorbox({onClosed: function(){ x.remove(); }});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-12-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-13
    • 2014-03-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多