【发布时间】:2016-08-11 05:00:55
【问题描述】:
我在我的页面上使用引导滑块。当滑块移动到下一个时,我需要暂停当前播放的视频。 我尝试使用youtube回调,但它似乎不起作用,可能是我的申请方式不对。
这是我用过的
jQuery(function ($) {
$('div.carousel-inner div.active').attr('id', 'current');
});
function callPlayer(frame_id, func, args='') {
if (window.jQuery && frame_id instanceof jQuery) frame_id = frame_id.get(0).id;
var iframe = document.getElementById(frame_id);
if (iframe && iframe.tagName.toUpperCase() != 'IFRAME') {
iframe = iframe.getElementsByTagName('iframe')[0];
}
if (iframe) {
iframe.contentWindow.postMessage(JSON.stringify({
"event": "command",
"func": func,
"args": args || [],
"id": frame_id
}), "*");
}
jQuery(function ($) {
$('div.carousel-inner div.item').attr('id', '');
$('div.carousel-inner div.active').attr('id', 'current');
});
}
【问题讨论】:
-
请参考9bugs.in/…
标签: javascript jquery twitter-bootstrap youtube