JavaScriptからTwitterBootstrapModalでYouTubeビデオを起動および閉じる方法の簡単なデモが必要です(アンカータグをクリックするのではありません)。
これまでのところ、問題なく起動できますが、閉じるとバックグラウンドで再生され続けます。
これが私のhtmlです:
<div id="myModalThumbnail"><img src="http://placehold.it/250x150&text=Video%20Thumbnail">
</div>
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<iframe width="520" height="390" frameborder="0" allowfullscreen=""></iframe>
</div>
</div>
Javascript:
$('#myModalThumbnail').click(function () {
var src = 'http://www.youtube.com/v/KVu3gS7iJu4&rel=0&autohide=1&showinfo=0&autoplay=1';
$('#myModal').modal('show');
$('#myModal iframe').attr('src', src);
});
そしてjsfiddle: http: //jsfiddle.net/VtKS8/5/
次は何?