Monday, 15 September 2014

javascript - How to check whether jQuery handle is on or off? -


My JS code has something like the following ...

  a.off (' Mouseover '). ('Mouseover', function) (overletrigger (this);}); A.off ('click'). ('Click', function () {overlayTrigger (this, true);});   

And then during the mouse click, I delete them:

  $ (obj) .off ('mouseover'); $ (Obj) .off ('mouseout');   

But I want to click the next mouse, if these handles are closed, then I want to enable them again ... but I do not know how to 'mouseover' Close or not ...

Digging through Google is slightly different, because the keywords "on" and "off" and "mouseover" are not the method to find what I want ... & gt; ;; & Lt;

Any help / hints will be appreciated :)

Using the data, you can get a list of events related to the object.

If you are using jQuery 1.8 or above you will need to use the following:

 < Code> $ ._data (Elem, 'events');   

elem should be a HTMLElement, not a jQuery object or selector. If you have a jQuery object then you elem with elem.get (0) .

Can use jQuery version 1.8 below

  $ (elem) .data ('event');   

This will return an item with events, then you can see whether they are undefined or not.

Note: Keep in mind that if there is no event handler on the element, then the data will return undefined

No comments:

Post a Comment