Skip to content

Instantly share code, notes, and snippets.

@eladrkatz
Created July 21, 2019 12:06
Show Gist options
  • Save eladrkatz/89075c0a3a10711d7a068e19a17c302d to your computer and use it in GitHub Desktop.
Save eladrkatz/89075c0a3a10711d7a068e19a17c302d to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/rokerubega
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div id='hoverElement'>
Hover Me!
</div>
<div id='resultElement'>
</div>
<script>
window.addEventListener('load', () => {
const hoverElement = document.getElementById('hoverElement');
//console.log(hoverElement);
hoverElement.addEventListener('mousemove', (e) => {
//console.log(e);
const resultElement = document.getElementById('resultElement');
resultElement.innerText = `${e.clientX} : ${e.clientY}`;
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment