JQuery: what if I don't have a mouseleave function?

I use Drupal for the website, and I can only use jQuery 1.2.7 (not the most recent versions).

I want to fade / fade a div element, and I use the mouseover / mouseout functions.

However, this element contains several children, and when I click on it, the mouseout function starts because I am moving over one of its children.

Since I do not have a mouseleave function, how can I solve this problem?

thank

Updated:

<div id="parent">
  <p> blabla </p>
  <div><a> blabla </a>
  <p> blabla </p>
</div>
+3
source share
2 answers

jQuery (since version 1.0) has a hover event for processing this particular scenario. In addition, mouseleave has been in jQuery also since 1.0.

0

, target, , . span - , moutovered, .

<a href="#">Blah blah <span>hehehhehe</span></a>​

$("a").mouseover(function(e) {
    if(e.target == this) {
        alert('mouseover is on the anchor, do something special');   
    } else {
        alert('got a ' + e.target.tagName + ' and not a ' + this.tagName);
    }
});​

: http://jsfiddle.net/ss2F2/1/

+1

Source: https://habr.com/ru/post/1747855/


All Articles