1
我正在引導模態彈出播放YouTube視頻,應該停止點擊關閉或關閉外面。引導模式點擊關閉或外部點擊不會停止youTube視頻
以下是我的代碼。
<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content" style="width: 682px;">
<div class="modal-header" style="border:none;">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<iframe width="640" height="390" src="http://www.youtube.com/watch?v=8CdAfYwEGCI" frameborder="0" allowfullscreen></iframe>
</div>
</div>
</div>
</div>
我已經嘗試了StackOverflow上類似問題的下面的腳本,但它們不起作用。
腳本:
$('.close').click(function() {
$('#myModal2').hide();
$('#myModal2 iframe').attr("src", jQuery("#myModal2 iframe").attr("src"));
});
類似的問題#1簡稱:
How to stop a Youtube Video Playing on Twitter Bootstrap Model Close
Start/stop youtube iframe when modal is shown/hidden through the api and Jquery events
..更