$.live()上的Jquery colorbox分组问题
我在jQueryAjax live内容上使用这个jquery代码作为lightbox。但我想显示“下一步”和“预览”按钮。现在只显示图片和关闭按钮。我该怎么办$.live()上的Jquery colorbox分组问题,jquery,lightbox,colorbox,Jquery,Lightbox,Colorbox,我在jQueryAjax live内容上使用这个jquery代码作为lightbox。但我想显示“下一步”和“预览”按钮。现在只显示图片和关闭按钮。我该怎么办 $('a[rel=gallery]').live('click', function() { url = this.href; // this is the url of the element event is triggered from $.fn.colorbox({href: url}); return fals
$('a[rel=gallery]').live('click', function() {
url = this.href; // this is the url of the element event is triggered from
$.fn.colorbox({href: url});
return false;
});
之所以只看到图像和关闭按钮,是因为ColorBox与表示一系列图像的jquery对象集合没有关联 也就是说,如果ColorBox只有一个图像要显示,那么他会隐藏上一个和下一个UI元素 我们无法从你提供的信息中看出更多,但不知何故,你似乎只给了他一张图片
如果在第一次加载页面后通过Ajax获取新的图像,可以考虑将彩盒作为Ajax成功回调的一部分。
- 凯文M
$('a[rel="gallery"]').live('click', function(){
var $this = $(this);
var rel = $this.attr('rel');
// Build colorbox sequence
$this.closest('div').find('a[rel="'+rel+'"]').colorbox({ // find all matching items & init colorbox on them
open: false, // don't open, just init
rel: rel // use the rel
});
// Open the specific link's colorbox
$this.colorbox({open: true});
return false; // prevent
});