Can mouse events be detected on an object that is adjacent to, but not a child of, another element in the HTML?
For instance:
<style>
#test, test2 {
width: 100%;
height: 100%
}
</style>
<html>
<section class="full" id="test">
Full Screen
</section>
<section class="anotherFull" id="test2">
Full Screen As well
</section>
<script>
var elem = document.querySelector('#test2');
elem.addEventListener('hover', function(){
alert('you are hovering');
}, false);
</script>
<html>
Even if I hover over the page and try different methods like mouseenter
, mouseover
, or hover
, and examine the e
object from
document.addEventListener('hover', function(e){}, false)
; (such as e.target
), I cannot detect a hover event on the second adjacent element.