[英]How to add doubleclick event to Canvas element using the "AddEventListener" method?
I'm just trying to add a double click event to a HTML5 Canvas element.我只是想向 HTML5 Canvas 元素添加双击事件。 It works fine with:它适用于:
myCanvas.ondbclick
However, I want to use the addEventListener method to do that.但是,我想使用 addEventListener 方法来做到这一点。 I guess it might be a simple task but I googled everywhere and could not find it.我想这可能是一项简单的任务,但我到处搜索,但找不到。 What's the name of the event I should be using?我应该使用的事件名称是什么?
myCanvas.addEventListener('doubleclick?', function(){
// Some dazzling stuff happens be here
});
Hope it's possible, don't wanted to "break" my coding consistency.希望这是可能的,不想“破坏”我的编码一致性。
The event name is dblclick
:事件名称是dblclick
:
myCanvas.addEventListener('dblclick', function(){
// Some dazzling stuff happens be here
});
Also your first example is wrong, it should say:你的第一个例子也是错误的,它应该说:
myCanvas.ondblclick
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.