2
I have a problem.
I have two div with a certain distance between them. I would like that when I place the mouse on the first div, the second div appears and I can pass the mouse from one to the other without the second div disappearing. Only disappear when the mouse is out of both.
I know I could put all this inside a larger div and schedule the event for that div. But in my application, the div that will appear in Hover() is in another part of the code and I need it to be so.
Follow the fiddle: https://jsfiddle.net/hbp7kfp2/3/
HTML
<div id="div1"></div>
<div id="div2"></div>
CSS
#div1 {
width: 100px;
height: 100px;
background-color: red;
margin: 10px;
float:left;
}
#div2 {
width: 100px;
height: 100px;
background-color: blue;
margin: 10px;
float: left;
display: none;
}
JS
$('#div1, #div2').hover(function(){
$('#div2').show();
});
$('#div1, #div2').mouseleave(function(){
$('#div2').hide();
});
From now on, thank you.
so your code already does this, when you put the mouse between the two squares(Divs) it is in this condition(outside of both), you want the program to do ?
– SneepS NinjA
@Sneepsninja, that’s right. I think that would be the proper way. How do I do it?
– Fernando Dias