开发者

Is it possible to disable/re-enable fancybox only on specific elements?

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. Thank开发者_如何学Gos.


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


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.


This worked for me:

$('#element').removeClass('fancybox');

Hope it helps!


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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜