Mouseenter of DIV A sets DIV B to show(). What I want is on mouseleave of DIV A if they are not hovering over DIV B, hide DIV B. But, on mouseleave of DIV A if they are hovering over DIV B keep showing DIV B.
$('#DIVA').mouseenter(function() {
$('#DIVB').show();
}).mouseleave(function() {
//if DIVB not hovering
$('#DIVB').hide();
//end if
});
Could you add a class to #DIVB
on hover then check for it on mouseleave
for #DIVA
?
$('#DIVB').hover(function(){
$(this).addClass('active');
}, function(){
$(this).removeClass('active');
})
$('#DIVA').mouseenter(function() {
$('#DIVB').show();
}).mouseleave(function() {
if(!$('#DIVB').hasClass('active')){
$('#DIVB').hide();
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With