javascript - Metro UI 视频在对话框关闭时不会停止

标签 javascript html metro-ui-css

我正在使用 Metro UI 模板,但在使用视频时出现对话框问题。当我关闭对话框时,视频会继续播放。

我的代码是:

<script>
function showDialog(id){
    var dialog = $("#"+id).data('dialog');
    if (!dialog.element.data('opened')) {
        dialog.open();
    } else {
        dialog.close();
    }
}
</script>

然后对话框被调用:

<div data-role="dialog" id="video" class="padding20" data-close-button="true" data-overlay="true" data-overlay-color="op-dark">
<h2>Title of Video</h2>

<video width="800px" controls="controls">
    <source src="videos/video.mp4" type="video/mp4">

    Your browser does not support the HTML5 Video element.
</video>

</div>

有人知道如何在对话框关闭时停止视频吗?

最佳答案

好的,所以我已经设法解决了这个问题。

我将视频放在 iframe 中,然后在对话框关闭时使用我在此处找到的代码刷新 iframe http://www.codingforums.com/html-and-css/168580-refresh-iframe-without-page-refresh.html

关于javascript - Metro UI 视频在对话框关闭时不会停止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34268849/

相关文章:

javascript - 使用 javascript 获取特定类的总行数

java - 创建我自己的文档查看器

javascript - 为 javascript 函数内包装的 jquery 参数赋值

html - 使用 CSS(响应式)裁剪和缩放图像的特定区域

css - ASP.NET CheckBoxList ListItem 没有换行

c# - 地铁 UI CSS ASP NET MVC

javascript - 使用 javascript 单击时切换类

javascript - 悬停时用淡入淡出交换图像

html - 在 html 中设置表格样式

html - 链接 metro css 和 jade