Destroy the binding between a jquery function and my object?
If i use some really simple code like :
$('#elm').tipTip();
It will do what the plugin is intended for. Is there a way to destroy this binding to the plugin tipTip()
will no long bind itself to this element?
UPDATE
The reason is, it's not that I want to stop the tips from popping up, I have one main data div that the user sees, a开发者_如何学编程nd as they click around the content from hidden divs is moved into it with a snazzy transition.
The plugin works great once, but then if I remove the content and then add it back in again (click something else and then back again) they don't work.
I assumed the best thing was to remove the whole tip plugin binding from my element and then start again every time the content is moved into the box, perhaps not.
First things first if asking such a question it would be nice if you include a link to the plugin your are using. Is this the TipTip you mean? If yes:
As far as I can see this plugin doesn't have the functionality built in to "destroy" a already created TipTip object. (At least there is no notion of this in the documentation and the source code too on quick inspection doesn't offer this).
As I'm not familiar with the plugin itself and you didn't detail how you are using it I'm not sure my solution will work out for you. But you can try and then give feedback if it did.
This should stop the tip tip from showing up.
$('#elem').unbind('hover');
Problems with this solution:
- It only unbinds the event the plugin binds itself to
- The TipTip object isn't really removed but just no longer triggered
- This won't work if you yourself have bound another handler to the hover event of this element
If there is only one element on your page with the TipTip functionality you might consider removing the additional DOM stuff the plugin uses too
$("div[id^=tiptip_]").remove(); //remove the tiptip holder/content/arrow divs
I found just rebind tipTip()
to the element and it will override the old tip.
精彩评论