我创建了一个颜色盒,它工作得很好。问题是,当我关闭它,并在页面上打开一个不同的colorbox时,两个colorbox都加载(第一个紧跟在第二个之后)。当我关闭它们,打开另一个,我得到三个colorboxes,等等。
我在Drupal7视图中执行此操作,我为所有图像字段添加了colorbox链接。
我调用colorboxes的代码如下:
$(‘..views字段-字段-图库-图像.字段-内容img’)函数(.each(){
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');
});发布于 2013-08-30 07:06:15
在你的颜色盒中使用这个:
var x = $(this).colorbox({onClosed: function(){ x.remove(); }});https://stackoverflow.com/questions/18521008
复制相似问题