开发者

Add jQuery colorbox plugin to a dynamically created element, extra problem

开发者 https://www.devze.com 2022-12-31 11:15 出处:网络
I saw the answer of a question: Add jQuery colorbox plugin to a dynamically created element Solve part of the problem, works fine, but when I click for second time, it doesn\'t work.

I saw the answer of a question: Add jQuery colorbox plugin to a dynamically created element

Solve part of the problem, works fine, but when I click for second time, it doesn't work. When I try to click for second time an error displays: $.fn.colorbox is not a function. How can i correct that error and avoid a doubl开发者_运维知识库e click to bind colorbox.

I don't speak english, i did my best to write this words, i hope you can read me. Thanks.


$('.colorbox').die().live('click', function() {
  $.colorbox({href:$(this).attr('href'), open:true});
  return false;
}

That should help you put a ".die()" before the ".live("

0

精彩评论

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