I'm trying to make a javascript script that captures the ordinary click, double click, and click and keep clicked for 2 seconds, but did not succeed. The click and double click ok, but how can I do the three in the same function, something like:
var click = function(element,click,dblclick,keedClicked){
//function return callback for click, dblclick and keepClicked
}
click('element',function(){
//code for click
},function(){
//code for double click
},function(){
//code for keep click
});
My problem is to join these functions in a function. Ex .: If I click on a button, it is an action. If I double-click, it makes other action. If I click and hold, it makes a third action. But before the action, we need to detect the type of click.
Another example is: In a button, if I click, I open the options, if I double-click, I edit the name of the label, and opens up the Advanced Options button (or something). A button, three possibilities of action.