Commits

Colin Copeland committed 98f496b

use alternate mouse postition technique for FF compatability

  • Participants
  • Parent commits 975bb94

Comments (0)

Files changed (1)

File tic-tac-toe/media/game.js

     var canvas = $('#board');
     var ctx = canvas.get(0).getContext("2d");
     canvas.click(function(e) {
-        draw(ctx, e.offsetX, e.offsetY);
+        var x = e.pageX - this.offsetLeft;
+        var y = e.pageY - this.offsetTop;
+        draw(ctx, x, y);
     });
     canvas.mousemove(function(e) {
-        $('#coords').text(e.offsetX + ', ' + e.offsetY);
+        var x = e.pageX - this.offsetLeft;
+        var y = e.pageY - this.offsetTop;
+        $('#coords').text(x + ', ' + y);
     });
     
     // draw basic board