0
使用Bootstrap 3和它的模式,我試圖通過rel屬性和jQuery加載YouTube視頻。我以前在Bootstrap 2.3.2模式下工作,但是用BS3我也無法工作。我得到模態窗口顯示,但沒有加載。Bootstrap 3模式不加載YouTube視頻
HTML:
<div id="myModal" class="modal fade yt-link" rel="kfVsfOSbJY0">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h1 class="h3">It's Friday!</h1>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
JS:
$('.yt-link').on('show', function() {
$(this).html('<iframe width="533" height="400" src="https://www.youtube.com/embed/' + $(this).attr('rel') + '?rel=0;showinfo=0;autohide=1;controls=2;autoplay=1" frameborder="0" allowfullscreen></iframe>');
});
$('.yt-link').on('hide', function() {
$(this).html(' ');
});