Skip to content

Instantly share code, notes, and snippets.

@ElemarJR
Created November 21, 2011 22:28
Show Gist options
  • Save ElemarJR/1384173 to your computer and use it in GitHub Desktop.
Save ElemarJR/1384173 to your computer and use it in GitHub Desktop.
<!DOCTYPE>
<html>
<head>
<title>JQuery Events</title>
<style type="text/css">
canvas
{
border: 1px solid Black;
}
</style>
</head>
<body>
<canvas id="myCanvas" width="500" height="500">
</canvas>
<div id="target">
</div>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="rx.js" type="text/javascript"></script>
<script type="text/javascript" src="rx.jQuery.js"></script>
<script type="text/javascript">
$(function () {
var mousemove = $("#myCanvas").toObservable("mousemove");
mousemove.Subscribe(function (e) {
$("#target").text(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