0

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

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
chaonextdoor
  • 5,019
  • 15
  • 44
  • 61

2 Answers2

1

Have you tried event.timeStamp?

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

bfavaretto
  • 71,580
  • 16
  • 111
  • 150
P. Galbraith
  • 2,477
  • 21
  • 24
  • 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 Apr 04 '12 at 03:42
0

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;
        console.log(startTime);
    });
thecodeparadox
  • 86,271
  • 21
  • 138
  • 164