Youtube延迟自动开始视频
无论如何都可以延迟 youtube 视频的自动启动,例如:页面加载后 20 秒?"
There is anyway to delay the auto start of a youtube video for example:" 20seconds, after page loads?"
这里是自动启动的例子:
Here is the example just with the auto start:
http://jsfiddle.net/qbqEA/
谢谢
推荐答案
这不是完美的解决方案,但它确实有效,
It is not perfect solution but it works,
<iframe class="delayed" width="486" height="273" frameborder="0" data-src="__url__" allowfullscreen=""></iframe>
请注意,我使用 data-src 而不是 'src'
note that I used data-src instead of 'src'
$(document).ready(function() {
setTimeout(function() {
$('iframe.delayed').attr('src',
$('iframe.delayed').attr('data-src'));
}, 20000);
}
它会在页面加载后 20 秒加载 iframe.看我的叉子:http://jsfiddle.net/WswGV/
It will load iframe 20 seconds after page loads. see my fork: http://jsfiddle.net/WswGV/
相关文章