我有六个链接到我的服务器上保存的mp4视频,并希望每个链接打开一个videoModal弹出窗口并播放视频。每个链接播放相同的视频。我做错了什么?
示例链接1
<a href="#videoModal" class="gallery-box video" data-toggle="modal" data-video="mp4/totalise.mp4" data-target="#videoModal">
<img src="img/totalise.jpg" class="img-responsive" alt="Image 1">
<div class="gallery-box-caption">
<div class="gallery-box-content">
Totalise : Sound of Flak
</div>
</div>
</a>
示例链接2
<a href="#videoModal" class="gallery-box" data-toggle="modal" data-video="mp4/gyibbk.mp4" data-target="#videoModal">
<img src="img/gyibbk.jpg" class="img-responsive" alt="Image 1">
<div class="gallery-box-caption">
<div class="gallery-box-content">
gyibbk (edit) : Solo project
</div>
</div>
</a>
我还有四个像这样只更改视频文件和标题的网址。 然后使用以下代码
<div id="videoModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<iframe width="100%" height="350" src="" frameborder="0" allowfullscreen></iframe>
</div>
</div>
</div>
</div>
这是js
$(function() {
$(".video").click(function () {
var theModal = $(this).data("target"),
videoSRC = $(this).attr("data-video"),
videoSRCauto = videoSRC + "?modestbranding=1&rel=0&controls=0&showinfo=0&html5=1&autoplay=1";
$(theModal + ' iframe').attr('src', videoSRCauto);
$(theModal + ' button.close').click(function () {
$(theModal + ' iframe').attr('src', videoSRC);
});
});
});