我想在关闭多模态视频iframe时停止。
这是我的代码。
滑轨
<% @chapter.episode.each do |episode| %>
<button type="button" class="btn" data-toggle="modal" data-target="#myModal<%= episode.id %>">
<%= episode.name %>
</button>
<div class="modal fade" id="myModal<%= episode.id %>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<a id="close" class="btn-floating red right close"><i data-dismiss="modal" aria-label="Close" title="Cerrar" class="right material-icons">close</i></a>
</div>
<div class="modal-body">
<iframe frameborder="0" width="480" height="270" src="<%= episode.url %>" allowfullscreen></iframe>
</div>
</div>
</div>
</div>
<% end %>
的Javascript
$(".modal").on('hidden.bs.modal', function (e) {
$('div[id^="myModal"]').each(function{
$("div[id^='myModal'] iframe").attr("src", $("div[id^='myModal'] iframe").attr("src"));
});
});
当我关闭模态时,请更改所有视频的src。
请帮帮我。