gpt4 book ai didi

javascript - Twitter Bootstrap Modal 停止 Youtube 视频

转载 作者:IT王子 更新时间:2023-10-29 03:10:37 24 4
gpt4 key购买 nike

我是 javascript 的新手,正在尝试使用 Twitter bootstrap 快速启动并运行一个美观的网站。我知道这与 jquery 有关,但我不确定在按下关闭按钮或关闭图标时如何停止我的视频。

谁能解释一下如何让我的视频停止播放,因为即使我关闭了窗口,我仍然可以在后台听到它。

<!-- Button to trigger modal -->
<a href="#myModal" role="button" class="btn" data-toggle="modal"><img src="img/play.png"></a>

<!-- Modal -->
<div id="myModal" class="modal hide fade" tabindex="-1" role=labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria>×</button>
<h3 id="myModalLabel">I am the header</h3>
</div>
<div class="modal-body">
<p><iframe width="100%" height="315" src="http:com/embed/662KGcqjT5Q" frameborder="0" allowfullscreen></iframe></p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div>

最佳答案

我知道我迟到了 2 年多,但从那以后,一些事情发生了变化,B3 开箱即用的新方法是这样的:

$("#myModal").on('hidden.bs.modal', function (e) {
$("#myModal iframe").attr("src", $("#myModal iframe").attr("src"));
});

享受 Bootstrap 带来的乐趣!

关于javascript - Twitter Bootstrap Modal 停止 Youtube 视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13799377/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com