I wonder if there is any way to calculate mouse click in seconds.
Just to make it clear, if user keeps the mousedown for 5 seconds, I wanna write to console '5 sec' etc.
There is any way to do it?
Thanks!
I wonder if there is any way to calculate mouse click in seconds.
Just to make it clear, if user keeps the mousedown for 5 seconds, I wanna write to console '5 sec' etc.
There is any way to do it?
Thanks!
Get a startDate on mouseDown then get endDate on mouseUp and calculate difference between these dates, convert second. And.... just console.log :)
Well, I think you should have a look at the Date object in Javascript, as well as to the events being fired during a click (mousedown is not the only one).