首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Colorbox加载所有以前的Colorbox

Colorbox加载所有以前的Colorbox
EN

Stack Overflow用户
提问于 2013-08-30 05:09:17
回答 1查看 82关注 0票数 0

我创建了一个颜色盒,它工作得很好。问题是,当我关闭它,并在页面上打开一个不同的colorbox时,两个colorbox都加载(第一个紧跟在第二个之后)。当我关闭它们,打开另一个,我得到三个colorboxes,等等。

我在Drupal7视图中执行此操作,我为所有图像字段添加了colorbox链接。

我调用colorboxes的代码如下:

$(‘..views字段-字段-图库-图像.字段-内容img’)函数(.each(){

代码语言:javascript
复制
    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');
});
EN

回答 1

Stack Overflow用户

发布于 2013-08-30 07:06:15

在你的颜色盒中使用这个:

代码语言:javascript
复制
var x = $(this).colorbox({onClosed: function(){ x.remove(); }});
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18521008

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档