当我点击图片时,我正试图开始播放YouTube视频。我可能只是不知道我应该把点击指向iframe的哪一部分,但无论如何我都被卡住了。
这是我的密码。提前谢谢。
<div id="image">
<img src="example.png">
</div>
<iframe id="youtube" width="560" height="315" src="https://www.youtube.com/embed/kJQP7kiw5Fk" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
$(document).on('click', '#image', function(e) {
$("#youtube").trigger('click');
});