I'm creating a horizontal scroll website and wondering if I can make the addEventListener disable when the cursor pointer is located within an element.
Here is an example.
<div class="bar">Disable mousewheel event when the cursor pointer is within this div</div>
<script>
window.addEventListener("mousewheel", (e) => {
if (e.deltaX === 0) {
e.stopPropagation();
e.preventDefault();
window.scrollBy(e.deltaY, 0);
}
});
</script>