Is it possible using jQuery to ‘time’ how long the cursor is hovering over a certain element? It would be nice if someone could put me in the right direction.
Thijs
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I did it using jQuery’s .hover() – you can basically store the start time in the element’s
.data, and compare it toDate().getTime()when the mouse leaves.Knocked up a working fiddle here: http://jsfiddle.net/XQ9kY/1/
The HTML:
The jQuery: