javascript - jquery temporary unbinding events -
Maybe I'm missing out on something completely handling jQuery, but this is my problem .
Let's assume that any event is binding, such as
$ (element) .bind ("mousemove", somefunc);
Now, I want to start a new musicminding which does not override the previous one, but temporarily out (Unbland) in other words, when I bind my work , Then I should be sure that unless I restore them, no other work will ever be executed for that event.
I am looking for something:
$ (element) .bind ("mousemove", somefunc); // Somefunc has been regularly saved binary = $ (element) .getCurrentBinding ("mousemove"); $ (Element). Unbind ("mousemov"). Dam ("Mausomov", Myfung); $ Myfunc instead of $ (element). Unbund ("mausomov", myfunk). Bund ("mousemov", saved binding); Of course, some control is not in my control, or it will be useless :) Is it possible to pair multiple tasks in the same event, and those tasks Execution can not be predefined. I know about the dissemination of the event and the prevention of the spread of the immediate event, but I think that in my case they are worthless, because the execution order can not be determined (but maybe I am getting it wrong).
How can I do this? Thanks in advance, ~ Aki
EDIT: I need to highlight it: I do not need to execute the pre-installed handler (Ffunc). I am not defining that handler, it may or may be, but it may not be installed by a third-party user. EDIT2: OK, it's not possible right now, I think I need event list author list, which is not yet implemented in most browsers.
There may be another way to use custom events, with some of these lines: < / P>
var flag = 0; $ (Element) .bind ("mousemove", function () {if flag} {$ (this) .trigger ("supermousemove");} and {$ (this) .trigger ("magicmousemove")}}}) .bind ("supermassov", function () {// something to do}}. Bind ("magicmosmove", function () {// something magical}}; $ ("#foo") Click (function () {flag = flag == 1? 0: 1; // simple switch});
Extremely annoying demo here:
Comments
Post a Comment