I am trying to do 2 different functionalities on one button on mousedown – up events.
But its not working as i cant able to detect time on mousedown event.
var flag;
$("#ClikerButton").mousedown(function(e){
//if mouse pressed more than 2 sec, then
// do func1 and set flag = true;
//else do nothing
}).mouseup(function(e){
//if flag == true, do nothing,
//else do func2;
});
You can use:
Fiddle: http://jsfiddle.net/simevidas/Pe9sq/2/
Reference: Detecting time on mousedown event