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
精彩评论