Skip to content

Instantly share code, notes, and snippets.

@PatrickKing
Created July 4, 2016 20:27
Show Gist options
  • Save PatrickKing/3f9c3eb1da1e4aa79c2c141dcbf9a7cb to your computer and use it in GitHub Desktop.
Save PatrickKing/3f9c3eb1da1e4aa79c2c141dcbf9a7cb to your computer and use it in GitHub Desktop.
Mousewheel/Touchpad inertia
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
div {
height: 90%;
width: 90%;
background-color: gray;
display: block;
position: absolute;
}
</style>
</head>
<body>
<div id="mydiv"> </div>
<script type="text/javascript">
el = document.getElementById('mydiv');
el.addEventListener('wheel', function(myevent) {
console.log(myevent.deltaX + " " + myevent.deltaY);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment