is this possible?
Like when you have a lightbox plugin: $('.foo').lig开发者_JAVA百科htbox()
Can you remove lightbox() from all .foo'
s, or only from specific a .foo
?
You might find this interesting Unbinding Plugins
You can do it two ways. One is to remove it from $ altogether - probably not what you want - by doing
$.lightbox = null;
If you want to do it to a set of elements, you would need to do this:
var elements = $('.foo');
elements.lightbox = null;
Note that this won't remove that function from subsequent calls to $, as that will generate a fresh jQuery object w/ all available plugins when you call it.
The selector applies to all instances.
精彩评论