I am sure I am not the first looking for this, but I did not find any solution to my problem..
I am looking for a way to fire an event after and only after a 3 seconds maintained click.
I tried with javascript setInterval() function with mouseup/mousedown Jquery events but it did’t work.
Someone has an idea ?
I have a div, I keep the mouse button down for 3 seconds, and something will be fired.
3 seconds timer must be reinitialized every time.
Call
setTimeout()to perform your action after 3000 milliseconds, storing the identifier fromsetTimeout()into a variable scoped above the function. On the element’smouseup(), clear the timeout if it exists viaclearTimeout().