How to rebind jQuery Color box after some items have been filtered
A have a galeria of items that shows a bigger picture after clicking.
But after filteri开发者_开发问答ng some elements (using .hide()
), the ColorBox slideshow keeps showing all elements.
I've tried to use:
$('.colorbox').die().live('click', function() {
$.fn.colorbox({href:$(this).attr('href'), open:true});
return false;
}
But it does show the slideshow with all the items in the rel
only the item clicked.
How can I rebind all the items not filtered?
Have you tried removing the rel attribute when hiding the filtered elements? You can do this in jquery using removeAttr
Perhaps add the :visible pseudo-class selector to your colour box selector (untested)?:
$('.colorbox:visible').die().live('click', function() {
$.fn.colorbox({href:$(this).attr('href'), open:true});
return false;
}
精彩评论