0

I have a few keyboard events bound the the arrow keys in jQuery. These function correctly until a user clicks inside of an iframe (which is a live video feed from ustream). At this point, none of the events fire until the user clicks on an element out of the iframe. Is there a way to force the events to fire no matter where the user clicks?

I tried putting a 100% width and height div over the top of the frame and setting it to .01 opacity, but this disallowed users to close ads on the video, which is an undesirable effect.

Link is here: http://josephndenton.com/robotdraw/

4

1 回答 1

0

不要忘记,为了在 iframe 中执行任何 jquery 内容,您需要使用 contents 方法。

例如:

<iframe id="iframe1"><div id="div1"></div></iframe>

$("#iframe1").contents().find("#div1").keyup(function(e)
{ //do your stuff });
于 2012-11-03T22:05:50.240 回答