【发布时间】:2013-05-25 18:25:57
【问题描述】:
我有一个相同的来源 iframe。 iframe 中的鼠标事件在文档中触发,如下所示:
// this won't work
$('iframe').contents().find('body').on('mousedown mouseup mousemove', function(e) {
$(document).trigger(e);
});
// this does work
$('iframe').contents().on('mousedown mouseup mousemove', function(e) {
$(document).trigger(e);
});
我的问题是,如果 mousedown 发生在 iframe 中并且鼠标离开 iframe,文档不会触发它自己的 mousemove 事件,直到 mouseup 发生。
我已经尝试在鼠标离开 iframe 后同时在 iframe 和文档中触发 mouseup,但文档 mousemove 事件在发生物理 mouseup 之前不会恢复。
【问题讨论】:
标签: javascript jquery events iframe mousemove