I have a textarea over a div. In the div I highlight certain parts of the text entered into the textarea. I'm trying to get mouse over events on the highlights but obviously I can't because they are under my textarea. I was thinking if this might be possible using mousemove events on the textarea to track the mouse coordinates but then I figured that that would do me no good as I can't determine the exact boundaries if the highlight spans.
So the question is, how do I simulate mouseover and mouseout events for elements that do not receive these because they are under other element(s)?
EDIT:
I completed a workaround for this based on Marcus' answer. Full code for mouseover / mouseout events:
var mouseDown = false;
var mouseIsOver = false;
var lastOverElem = false;
textarea.mousemove(function(e) {
if (!mouseDown) {
textarea.hide();
var elm = $(document.elementFromPoint(e.pageX, e.pageY));
textarea.show();
if (elm.hasClass("highlighted")) {
/* MOUSE MOVE EVENT */
if (!mouseIsOver) {
mouseIsOver = true;
/* MOUSE OVER EVENT */
}
} else {
if (mouseIsOver) {
mouseIsOver = false;
if (lastOverElem) {
/* MOUSE OUT EVENT */
}
}
}
}
});
$('body').mousedown (function () {mouseDown = true;});
$('body').mouseup (function () {mouseDown = false;});