Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
169
rated 0 times [  173] [ 4]  / answers: 1 / hits: 54002  / 13 Years ago, fri, june 24, 2011, 12:00:00

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.addEventListener('doubleclick?', function(){ 

// Some dazzling stuff happens be here

});


Hope it's possible, don't wanted to break my coding consistency.


More From » html

 Answers
26

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

[#91526] Thursday, June 23, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
demondp

Total Points: 154
Total Questions: 97
Total Answers: 99

Location: Mali
Member since Thu, Jul 9, 2020
4 Years ago
;