Mouseout on specified divs and keep original div open

后端 未结 2 1052
别跟我提以往
别跟我提以往 2021-01-25 08:27

I\'m trying to do this in plain english: I have an open div from a mouseover event, when I take the mouse out of the div it closes on mouse out, perfect. What I need is that whe

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-25 09:17

    $("#openDiv").mouseout(function (e) { //you forgot to add the event `e` element
        var $c = $(e.target);
        if ($c.is('div.x') || $c.is('div.y')) //you forgot $c.is on the second part
        {
            $("#openDiv").show(); 
        } else {
            $("#openDiv").hide(); 
        }
    });
    

提交回复
热议问题