-1

我试图弄清楚如何在 iframe 中捕获隐藏事件(显示:无;)。我有三个 iframe,一次只有一个可见,另外两个 iframe 是隐藏的。我正在使用 jQuery show()、hide() 方法来隐藏和显示不同的 iframe:

$('#currentFrame').hide();
$('#newIframe').show();

我在这些 iframe 中嵌入了 wistia 视频,当一个 iframe 切换到另一个 iframe 时,我想暂停当前视频。因此我想捕获隐藏事件。

在 iFrame 里面我试过这个,但它没有被触发

$(document).blur( function () { var video = Wistia.api("video1"); video.pause(); });

4

1 回答 1

1

使用以下示例,它使用 postMessage 函数

https://robertnyman.com/html5/postMessage/postMessage.html

于 2017-07-04T12:22:07.450 回答