Py学习  »  Jquery

添加自动播放到youtube iframe on按钮单击jquery不工作

Alex • 5 年前 • 1783 次点击  

我使用自定义按钮来保持设计的一致性。我添加了一个按钮,它位于 iframe 使用 z-index CSS中的属性。单击 伊夫拉姆 反应但不开始玩。我在其他网站上使用过这个代码,它运行得很好。

此代码在Safari中有效,但在Chrome中无效。我不确定是否应该尝试重新安装Chrome。

我还添加了其他1行我已经尝试(注释掉)。有人能提出为什么这不适用于Chrome吗?

$('#playLucid').click(function() {
  $('#playLucid').css('display', 'none');
  //$("#expose").attr('src','https://www.youtube.com/embed/7bU-x8pJbig?autoplay=1');
  $("#expose")[0].src += "?autoplay=1";
});
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/38055
 
1783 次点击  
文章 [ 1 ]  |  最新文章 5 年前
Kiran Shahi
Reply   •   1 楼
Kiran Shahi    6 年前

这可能有效:

<iframe type="text/html" 
    src="https://www.youtube.com/embed/..?autoplay=1" frameborder="0" 
    allow="autoplay">
</iframe>

如果不起作用,请尝试添加 mute=1 muted=1 :

src="https://www.youtube.com/embed/..?autoplay=1&mute=1