Wednesday, May 2, 2012

how to calculate time during mousedown event in jquery?

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;
});




No comments:

Post a Comment