如何将事件从具有更高z索引的元素传播到不包括单击事件的元素?



我有一个组件,其中有标记。Marker是一个带图标的样式div。标记有click, mouseenter和mouselleave事件。鼠标进入时出现工具提示。在标记的顶部,我可以放置其他元素来覆盖它们。这个元素的z指数更高。我仍然希望能够悬停(mouseenter, mouseleave)在较低的z-index元素(标记)上,同时防止在它们被覆盖时单击事件。是否有任何解决方案,只通过少数或排除只有一些事件从传播更高的z指数元素?

<!DOCTYPE html>
<style>
#elmHigherZindexID {
width: 100px;
height: 100px;
position: absolute;
background-color: chartreuse;
z-index: 1000;
}
#elmLowerZindexID {
width: 100px;
height: 100px;
position: absolute;
background-color: cornflowerblue
}
</style>
<body>
<div id="elmHigherZindexID">HIGH</div>
<div id="elmLowerZindexID">LOW</div>
</body>
<script>
let highElmRef = document.getElementById('elmHigherZindexID');
let lowElmRef = document.getElementById('elmLowerZindexID');
highElmRef.addEventListener('click', highEventHandler);
highElmRef.addEventListener('mouseenter', highOtherEventHandler);
lowElmRef.addEventListener('mouseenter', lowEventHandler);
function highEventHandler(event) {
event.stopPropagation();
console.log('high', event);
}
function highOtherEventHandler(event) {
event.stopPropagation();
console.log('high', event);
const cusEvent = new MouseEvent('mouseenter', {
view: window,
bubbles: true,
cancelable: true
});
lowElmRef.dispatchEvent(cusEvent);
}
function lowEventHandler(event) {
event.stopPropagation();
console.log('low', event);
}
</script>
</html>