When hover shows that div, clicks on div, at this time, it is very likely that hover will fail and div will disappear. May I ask how to solve the problem?

dom is as follows:

<li>
    <a href="javascript:;" title=""></a>
    <div class="pop">div</div>
</li>

css is as follows:

.pop {
    display: none;
    position: absolute;
}
li {
    position: relative;
}
li:hover {
    .pop {
        display: block;
    }
}
Under

chrome:
when hover li , div.pop is displayed. Clicking div.pop multiple times (not continuous fast clicks, but random clicks) may cause the div to disappear.

Note: there is a broadcast in the div. Click the arrow inside to have a sliding effect.

personal guess:
1, click causes the mouse to lose focus and hover is invalid.
2, click elements with css3 attribute will cause hover invalidation.

this bug has a terrible headache. Can you give me a solution? Thank you!

Apr.07,2021

I have the same problem. Has the landlord solved it?


use js to control display and hide, add onmouseover and onmouseout functions to the parent element li
Hidden DIV you control and click on the function

< style >

.pop {
    display: none;
    position: absolute;
}
li {
    position: relative;
}
/*li:hover .pop {*/
    /*display: block;*/
/*}*/

< / style >
< body >

<li onmouseover="show()" onmouseout="hide()">
    <a href="javascript:;" title=""></a>
    <div class="pop" id="pop"  onclick="check()">
        div
    </div>
</li>

< / body >
< script >

var i=0
function show() {
    document.getElementById('pop').style.display = 'block'
}
function hide() {
    document.getElementById('pop').style.display = 'none'
}
function check(){
    console.log('' + iPP)
}

< / script >


add parameters to isolate the hover event from the click time
var isMouseOver = true; / / controls the conflict between the mouse hover event and the click event

$(".div").hover(function(){
    isMouseOver = true
    //
},function(){
    if(isMouseOver){
        //
    }
});
$(".div").click(function(){
isMouseOver = false;
//

});


has the landlord solved it?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bdd027-31338.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bdd027-31338.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?