Naši dobrovolníci ještě tento článek do jazyka Čeština nepřeložili. Přidejte se a pomozte nám tuto práci dokončit!
Tento článek si můžete přečíst také v jazyce English (US).

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) { = event.clientX + 20 + 'px'; = event.clientY + 10 + 'px';
  }; = function(event) {
    node.textContent =;

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

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

links.forEach(link => {
  link.onmouseover =;
  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
onmousemoveChrome 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

Štítky a přispěvatelé do dokumentace

Poslední aktualizace od: mdnwebdocs-bot,