Created
July 26, 2017 08:02
-
-
Save tai2/94fff6b5d417933c5a3de0900246e1f6 to your computer and use it in GitHub Desktop.
mouseleave is not fired while dragging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<style> | |
.parent { | |
width: 300px; | |
height: 300px; | |
background: black; | |
padding: 100px; | |
} | |
.draggable { | |
width: 300px; | |
height: 300px; | |
background: blue; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="parent" class="parent"> | |
<div class="draggable" draggable="true">Draggable Item</div> | |
</div> | |
<script> | |
document.getElementById('parent').addEventListener('mouseenter', (ev) => { | |
console.log('mouseenter'); | |
ev.target.style.background = 'red'; | |
}); | |
document.getElementById('parent').addEventListener('mouseleave', (ev) => { | |
console.log('mouseleave'); | |
ev.target.style.background = 'black'; | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment