How to get the starting time of a mousemove event in javascript/jquery?

Go To


Is there any attibute associated with the starting time I can get from the 'event' parameter in the callback function of a mousemove event?

2012-04-04 03:16
by chaonextdoor


This code will store time (as timestamp) when mousemove happend first within a element:

 var startTime = null;
    $('<YOUR_ELEMENT>').one('mousemove', function(e) {
        startTime = e.timeStamp;
2012-04-04 03:34
by thecodeparadox


Have you tried event.timeStamp?

Returns the time (in milliseconds since the epoch) at which the event was created.

2012-04-04 03:21
by P. Galbraith
When suggesting a javascript feature, it's much better to link to the appropriate standard which is the definitive reference. Links to other locations (e.g MSDN and MDN) can be used for examples or proprietary features that either aren't in standards or are implemented differently to the standard - RobG 2012-04-04 03:42