Onze vrijwilligers hebben dit artikel nog niet naar het Nederlands vertaald. Doe mee en help de klus te klaren!
U kunt het artikel ook in het English (US) lezen.

The onmousemove property of the GlobalEventHandlers mixin is an EventHandler that processes mousemove events.

The mousemove event fires when the user moves the mouse.


target.onmousemove = functionRef;


functionRef is a function name or a function expression. The function receives a MouseEvent object as its sole argument.



This example creates link tooltips that follow your mouse. It uses the onmousemove, onmouseover, and onmouseout event handlers.


<p><a href="#" data-tooltip="First link">See a tooltip here &hellip;</a></p>
<p><a href="#" data-tooltip="Second link">&hellip; or here!</a></p>


.tooltip {
  position: absolute;
  z-index: 9999;
  padding: 6px;
  background: #ffd;
  border: 1px #886 solid;
  border-radius: 5px;


const tooltip = new (function() {
  const node = document.createElement('div');
  node.className = 'tooltip';
  node.setAttribute('hidden', '');

  this.follow = function(event) {
    node.style.left = event.clientX + 20 + 'px';
    node.style.top = event.clientY + 10 + 'px';

  this.show = function(event) {
    node.textContent = event.target.dataset.tooltip;

  this.hide = function() {
    node.setAttribute('hidden', '');

const links = document.querySelectorAll('a');

links.forEach(link => {
  link.onmouseover = tooltip.show;
  link.onmousemove = tooltip.follow;
  link.onmouseout = tooltip.hide;


Draggable elements

We also have an example available showing the use of the onmousemove event handler with draggable objects — view the example in action.


Specification Status Comment
HTML Living Standard
The definition of 'onmousemove' in that specification.
Living Standard  

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic supportChrome Full support YesEdge Full support YesFirefox Full support YesIE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes


Full support  
Full support

See also

Documentlabels en -medewerkers

Laatst bijgewerkt door: mfluehr,