在关闭模式时停止视频?

问题描述 投票:0回答:1

我的视频模态面临一个问题,当我关闭模态时,视频仍在后台播放,我没有任何线索。

当我关闭模式时有人可以帮助我停止播放视频吗?

我的js

<script>
    function PopUp(hideOrshow) {
        if (hideOrshow == 'hide') document.getElementById('popup-wrapper').style.display = "none";
        else document.getElementById('popup-wrapper').removeAttribute('style');
    }
    window.onload = function () {
        setTimeout(function () {
            PopUp('show');
        }, 100);
    }
    </script>   

这里是视频部分

<div id="popup-wrapper" style='display:none'>
    <div id="popup">
    <a href="#modal-close" class="modal-close" onClick="PopUp('hide')">X CLOSE</a>   
    <h1>HOW IT WORKS?</h1>   

   <div class="form-group">
      <video width="100%" controls>
        <source src="vdo.ogg" type="video/ogg" />
        <source src="vdo.mp4" type="video/mp4" />
        Your browser does not support the video tag.
      </video>
    </div>

    </div>
</div>

感谢

javascript jquery html5-video bootstrap-modal
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.