Youtube延迟自动启动视频 [英] Youtube delay auto start video

查看:130
本文介绍了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。
见我的fork: http://jsfiddle.net/WswGV/

It will load iframe 20 seconds after page loads. see my fork: http://jsfiddle.net/WswGV/

这篇关于Youtube延迟自动启动视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆