Detect mousemove when over an iframe?

后端 未结 11 574
Happy的楠姐
Happy的楠姐 2020-11-29 05:47

I have an iframe that takes up the entire window (100% wide, 100% high), and I need the main window to be able to detect when the mouse has been moved.

Already tried

11条回答
  •  一向
    一向 (楼主)
    2020-11-29 06:39

    If your target isn't Opera 9 or lower and IE 9 or lower you can use css attribute pointer-events: none.

    I found it the best way just to ignore iframe. I add class with this attribute to iframe in onMouseDown event and remove in onMouseUp event.

    Works perfect for me.

提交回复
热议问题