简体   繁体   English

在iframe上检测鼠标?

[英]Detect mouse over iframe?

I'd like call a function every time a user drags their mouse over an iframe (which points to a different domain). 每当用户将鼠标悬停在iframe(指向不同的域)上时,我都想调用一个函数。 Is this possible? 这可能吗?

I'm guessing you already tried setting a mouseover event on the actual iframe and it didn't work. 我猜你已经尝试在实际的iframe上设置mouseover事件,但它不起作用。 If so, you can try wrapping the iframe inside a div and set the mouseover event on that div . 如果是这样,您可以尝试将iframe包装在div并在该div上设置mouseover事件。 This has to work. 必须奏效。 In the worst case scenario make the div a little big bigger (1-2px padding) than your iframe. 在最坏的情况下,使div比你的iframe大一点(1-2px填充)。

将文件加载到iframe中,在该文件上设置mouseover事件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM