1

我正在动态添加 <iframe> 并添加 YouTube 视频。YouTube 播放器工作正常,但未显示全屏控件。

代码是:

var newIframe = $("<iframe width='80px' height='80px' "
  + "src='http://www.youtube.com/watch?v=r3TtgYuaVFk' "
  + "frameborder='0' allowfullscreen id='vid" + mindBoxID + "'>");
var tmp = "#"+mindBoxID;
$(tmp).append(newIframe);
4

1 回答 1

2

src的网址错误,请src='http://www.youtube.com/embed/r3TtgYuaVFk'改用。

var newIframe = $("<iframe width='80px' height='80px' "
  + "src='http://www.youtube.com/embed/r3TtgYuaVFk' "
  + "frameborder='0' allowfullscreen id='vid" + mindBoxID + "'>");
var tmp = "#"+mindBoxID;
$(tmp).append(newIframe);

<iframe> 嵌入视频的文档可在此处获取https://developers.google.com/youtube/player_parameters#Manual_IFrame_Embeds

于 2012-04-16T15:47:53.120 回答