Problem with jQuery Mouseenter / Mouseleave in Firefox

I have a problem with mosueenter / mouseleave events only in Firefox ...

http://www.screencast.com/users/StanleyGoldman/folders/Jing/media/be3572de-9c72-4e2a-8ead-6d29b0764709

<HTML>
    <HEAD>
        <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.js"></script>
        <script>
            $(document).ready(function() {
                $("#theDiv").mouseenter(function() {
                    $("#output").append('mouseenter<br>'); 
                });
                $("#theDiv").mouseleave(function() {
                    $("#output").append('mouseleave<br>');
                });
            });

        </script>
    </HEAD>
    <BODY>

    <div id="theDiv" style="position:relative; height: 300px; width:300px; background-color:Black;">
        <input type="text" style="position:absolute; top: 40px;" />

        <div style="position:absolute; top:100px; height:100px; width:100px; background-color:Red; overflow:auto;">
        <p>Content</p>
        <p>Content</p>
        <p>Content</p>
        <p>Content</p>
        <p>Content</p>
        <p>Content</p>
        <p>Content</p>
        <p>Content</p>
        <p>Content</p>
        <p>Content</p>
        <p>Content</p>
        <p>Content</p>
        </div>
    </div>

    <div id="output"></div>

    </BODY>
</HTML>

I only want to know when the mouse left containing the DIV. But if you either quickly move the mouse over the text box or hover over the div scrollbar, the events will light up.

- EDIT -

$("#theDiv").hover(function() {
    $("#output").append('hoverin<br>');
}, function() {
    $("#output").append('hoverout<br>');
});

I tried the following with a hang. It seems that this problem only occurs in Firefox.

+3
source share
2 answers

firefox, ​​ Firefox 3.6. jQuery inElement ( jQuery), .

+2

, hover() hoverIntent(), mouseenter/mouseleave, -, . , , , mouseenter/mouseleave.

+2

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


All Articles