I used jquery to set hover callbacks for elements on my page. I'm now writing a module which needs to temporarily set new hover behavior for some elements. The new module has no access to the original code for the hover functions.
I want to store the old hover functions before I set new ones so I can restore them when finished with the temporary hover behavior.
I think these can be stored using the jquery.data() function:
//save old hover behavior (somehow)
$('#foo').data('oldhoverin',???)
$('#foo').data('oldhoverout',???);
//set new hover behavior
$('#foo').hover(newhoverin,newhoverout);
Do stuff with new hover behavior...
//restore old hover behavior
$('#foo').hover($('#foo').data('oldhoverin'),$('#foo').data('oldhoverout'));
But how do I get the currently registered hover functions from jquery?
Shadow2531, I am trying to do this without modifying the code which originally registered the callbacks. Your suggestion would work fine otherwise. Thanks for the suggestion, and for helping clarify what I'm searching for. Maybe I have to go into the source of jquery and figure out how these callbacks are stored internally. Maybe I should change the question to "Is it possible to do this without modifying jquery?"