Problem with jQuery mouseleave firing when container has select box

后端 未结 9 2184
一整个雨季
一整个雨季 2021-02-13 23:47

I have a two containers -- one is nested inside of another. When I hover over the parent, I want the child container to appear. When I mouseout, I want the child container to f

9条回答
  •  无人及你
    2021-02-14 00:07

    You should only check if the current Element is a descendant of your container.

    If so abort the handler.

    See: jquery descendant

    Example:

    ContainerElement.mouseleave(function (e) {
    if (ContainerElement.has(e.fromElement).length > 0) return;
    // Do your Stuff
    });
    

提交回复
热议问题