Here is my HTML:
<div id="one"><div id="element1"></div></div>
<div id="two">some stuff</div>
div one
and two
are rectangles of same width and height
This is the CSS:
#one { position: relative; width: 390px; height: 482px; }
#two { position: relative; z-index: 100; top: -482px; width: 390px; height: 482px; }
As you can see div two
is positioned just over div one
used as a mask
I need to do something like that:
$('#element1').mouseover(function(e){ alert('Hello') });
I did that using mousemove
on div two
and checking if mouse position was between x
and x + width
of element1
(relative to the parent div one
) and same thing for y
.
That solution works but has a problem when I apply -webkit-transform:rotate(45deg);
to element1
I'm new and can't post an image but it's easy to understand that the area handled by the mousemove
on div two
doesn't correspond with the element1
div when it is rotated.
How can I know when the mouse moves above element1
?