Rebind a unbind click

Posted by Antonio Ortiz on Stack Overflow See other posts from Stack Overflow or by Antonio Ortiz
Published on 2012-10-01T15:36:31Z Indexed on 2012/10/01 15:37 UTC
Read the original article Hit count: 151

Filed under:

I am using this library that allows you to create a more elegant alert box (you can even use images!); I used it with a click function and it works! A nice container opens with a close button, GREAT! I noticed if you happen to click more than once on the link you assigned, it keeps firing. So multiple images begin to propagate. I used the unbind method, but it cancels the link permanently (until refresh etc.).

I was surprised to see the library doesn't compensate for this little problem, so I am wondering if you could rebind the click when you close the image window so it starts from the beginning.

$(".shopFrag").click(function(){
  Messi.img("_images/wishlist.jpg");                              
  $(".shopFrag").unbind('click');

});

© Stack Overflow or respective owner

Related posts about unbind