开发者

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. It works fine with:

myCanvas.ondbclick

However, I want to use the addEventListener method to do that. 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.addEventLis开发者_如何转开发tener('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:

myCanvas.addEventListener('dblclick', function(){ 

  // Some dazzling stuff happens be here

});

Also your first example is wrong, it should say:

myCanvas.ondblclick
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜