Detect mouseMove out event for HTML canvas element Have you tried mouseout? element.addEventListener ("mouseout", myFunction, false);