I have the following problem: I created a div and inside it there is a second div with a text.
<div class="red">
<div class="blue">OK</div>
</div>
The parent div has received an event to display message when the mouse over or out.
$(document).ready(function(){
$('.red').mouseover(function(){
alert('in');
}).mouseleave(function(){
alert('out');
});
});
However the div-child has received an absolute positioning, chained to the relative positioning of the parent div, simplifying, the child div will position itself just above the parent div
.red {width:200px;height:200px;background:red;position:relative}
.blue {width:100px;
height:100px;
background:blue;
color:white;
position:absolute;
z-index:1;
}
The problem is, if I hover the mouse or get off of one of the divs, the event will run normally, but when I step from div-parent to div-child and vice versa, events are fired .
I need Jquery to group the div-parent and div-child even if they are in absolute position, as long as both are a single element.
(obs .: It is crucial to maintain absolute positioning)