I have a problem.
I have two divs with a certain distance between them. I would like that when I position the mouse in the first div, the second div appears and I can move 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 like that.
Follow the fiddle: link
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();
});
Thanks in advance.