2016-04-13 8 views
1

window/documentオブジェクトにmouseoutイベントリスナーを追加しました。
カーソルをページのiframeに移動するとこのイベントがトリガーされますが、bodyの他の要素でもトリガーされます。JS:ドキュメント/ウィンドウのmouseoutイベント

document.addEventListener('mouseout', function(event) { 
    event.stopPropagation() 
    console.log('out') 
}, true) 
// not working so I try adding this event to widow 

window.addEventListener('mouseout', function(event) { 
    event.stopPropagation() 
    console.log('out') 
}, true) 
// not working too 

助けてください!

document.getElementById("sa").contentDocument.addEventListener('mouseout', function(event) { 
    event.stopPropagation() 
    console.log('out') 
}, true) 

をしかし、あなたのコンテンツは、クロスドメインがある場合は、アクセス権のエラーで終わる可能性があります読んでくれてありがとう:)

答えて

1

あなたはこのようなあなたのイベントを登録することができます。

関連する問題