Problem with jQuery mouseleave firing when container has select box

后端 未结 9 2191
一整个雨季
一整个雨季 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-13 23:59

    $('#parent-container').live("mouseenter", function () {
        var $this = $(this),
        $selectOptionsContainer = $this.find('#child-container');
        $selectOptionsContainer.stop().fadeTo('slow', 1.0);
    }).live("mouseleave", function (e) {
    
        /* Solution */
        if(e.relatedTarget == null) return;
        /************/
    
        var $this = $(this),
        $selectOptionsContainer = $this.find('#child-container');
        $selectOptionsContainer.stop().hide();              
    });
    

提交回复
热议问题