开发者

How to rebind jQuery Color box after some items have been filtered

开发者 https://www.devze.com 2023-02-12 06:29 出处:网络
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.

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;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消