1

Mousemove event stops working when the cursor enters on iframe: example

$(document)
  .on('mousemove', function(event) {
     console.log(event)
  })

is it possible to follow the cursor when it is on iframe area?

  • Possible duplicate of [Detect mousemove when over an iframe?](https://stackoverflow.com/questions/5645485/detect-mousemove-when-over-an-iframe) – Ethan Aug 28 '17 at 10:14

2 Answers2

2

Found solution, add css attribute:

pointer-events: none;

example

  • I am not sure that this is a real solution... pointer-evets:none - prevent to (for example) click on iframe, youtube or vimeo iframes. – vol4ikman Sep 28 '20 at 12:19
0

You may use:

$(window).on('mousemove', function (event) {
    console.log( event.target.tagName + ': ' + event.type);
});

or:

$(function () {
    $(document).on('mousemove', function (event) {
        console.log( event.target.tagName + ': ' + event.type);
    });
});

Your problem in: $(document).on('mousemove', function (event) { is:

the event is executed before the dom is ready or the window is loaded.

gaetanoM
  • 41,594
  • 6
  • 42
  • 61