Google chrome 在显示中自动播放视频无div
我已经提供了一个iframe视频,需要在fancybox中播放。 代码如下:Google chrome 在显示中自动播放视频无div,google-chrome,iframe,fancybox,Google Chrome,Iframe,Fancybox,我已经提供了一个iframe视频,需要在fancybox中播放。 代码如下: <a id="playLink" href="#pageVideo">Link for video </a> <div style="display:none"> <div id="pageVideo"> <iframe src="someVideo.mp4?autoplay=true" style="overflow:aut
<a id="playLink" href="#pageVideo">Link for video </a>
<div style="display:none">
<div id="pageVideo">
<iframe src="someVideo.mp4?autoplay=true" style="overflow:auto" frameborder="0" height="400" width="650"></iframe></div>
</div>
$('#homePlayLink').fancybox({
'padding' : 0,
'width' : 560,
'height' : 400
});
$(“#homePlayLink”).fancybox({
“填充”:0,
“宽度”:560,
‘高度’:400
});
问题是Chrome中的视频在页面加载时开始播放。因为它在display none div中,所以我没有看到它,但我听到了音频。如何解决这个问题,使视频只在点击链接后在花式方框中播放
谢谢。您的iframe src具有autoplay=true参数;这就是为什么它会在页面加载时自动播放 将iframe src指向一个空白页面,然后在fancybox打开时覆盖href怎么样
$("#tip4").click(function() {
$.fancybox({
'padding' : 0,
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'title' : this.title,
'width' : 680,
'height' : 495,
'href' : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
'type' : 'swf',
'swf' : {
'wmode' : 'transparent',
'allowfullscreen' : 'true'
}
});
return false;
});
请看第4节:显示youtube视频片段