Reputation: 963
I need to turn off/on fancybox on the elements of a list according to their focus status.
I cannot bind/unbind the click event completely, because there are other functions listening for the same event.
So, I need to know if fancybox provides a way of doing so.
If not, any alternatives to fancybox that meet this requirement would be appreciated as well.
Thanks.
Upvotes: 2
Views: 10736
Reputation: 1
fancybox have a binded click events, they have a proxy-name - fb-start, you can unbind handler.
It works for me,
$("#your-element").fancybox(); //fancybox is binded click.fb-start on #your-element
$( "#your-element" ).unbind('click.fb-start'); //click is unbinded
for this you must have a jquery library is loaded
Upvotes: 0
Reputation: 963
Unfortunately, none of the solutions proposed was the one I was looking for...
The correct answer was provided here by @Naren Sisodiya, who suggested using the live()
method (which at the time hadn't been surpassed yet by the new on
method).
I admit that the question could have been asked in a better form.. Sorry everyone..
Thank you.
Upvotes: 1
Reputation: 4666
This worked for me:
$('#element').removeClass('fancybox');
Hope it helps!
Upvotes: 0
Reputation: 2082
Why don't you simply play with the classes of your elements using addClass and removeClass? Then only when they have this class the fancybox will be triggered.
K
Upvotes: 6