Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/442.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 鼠标点击不';t使用Crafty.js触发事件_Javascript_Mouseclick Event_Craftyjs - Fatal编程技术网

Javascript 鼠标点击不';t使用Crafty.js触发事件

Javascript 鼠标点击不';t使用Crafty.js触发事件,javascript,mouseclick-event,craftyjs,Javascript,Mouseclick Event,Craftyjs,我一直在尝试使用Crafty.js构建一个游戏。我有一个图像,作为一个按钮,一旦用户点击它,他将被引导到下一页。然而,由于某些原因,鼠标点击并没有触发。有什么想法吗 Crafty.scene('Main', function () { Crafty.background("url('images/homeBackground.jpg')"); Crafty.e('2D, DOM, Mouse, next').attr({ //next is the image x: 600,

我一直在尝试使用Crafty.js构建一个游戏。我有一个图像,作为一个按钮,一旦用户点击它,他将被引导到下一页。然而,由于某些原因,鼠标点击并没有触发。有什么想法吗

Crafty.scene('Main', function () {
  Crafty.background("url('images/homeBackground.jpg')");
  Crafty.e('2D, DOM, Mouse, next').attr({ //next is the image
    x: 600,
    y: 600,
    w: 100,
    h: 50
  }).bind('click', function (e) {
    alert("Here?"); //this isn't firing
  });
});

事件名称区分大小写,您应该绑定到
单击事件


更多详细信息,请访问:

事件名称区分大小写,您应该绑定到
单击事件

详情请浏览: