Here is what I have so far:
var hoveredElement; //none per default
;(function($){
$.fn.isHovered = function(){
return (hoveredElement.length && $( this )[0] === hoveredElement[0] );
};
})(jQuery);
$(document).mouseover( function(e){
hoveredElement = $(e.target);
});
$(document).mouseover( function(e){
console.log( $(this).isHovered() );
});
Basically I have the following structure:
<div id='one'>
<div id="two">
<div id="three">
three
</div>
</div>
</div>
When I mouse over two, i’d like to return true whether it is #two or #three that I am mousing over.
How do i accomplish this?
Use the jQuery
.hover()API: http://api.jquery.com/hover/ and you should be able to view the current object via$(this).Something like: