簡體   English   中英

iframe的jQuery mousemove事件

[英]jquery mousemove event with iframe

當光標進入iframe時,mousemove事件停止工作: 示例

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

在iframe區域上是否可以跟隨光標?

找到解決方法,添加css屬性:

pointer-events: none;

您可以使用:

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

要么:

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

您在$(document).on('mousemove', function (event) {是:

在dom准備就緒或加載窗口之前執行該事件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM