<bdo id='a8TpU'></bdo><ul id='a8TpU'></ul>
    <tfoot id='a8TpU'></tfoot><legend id='a8TpU'><style id='a8TpU'><dir id='a8TpU'><q id='a8TpU'></q></dir></style></legend>

    1. <i id='a8TpU'><tr id='a8TpU'><dt id='a8TpU'><q id='a8TpU'><span id='a8TpU'><b id='a8TpU'><form id='a8TpU'><ins id='a8TpU'></ins><ul id='a8TpU'></ul><sub id='a8TpU'></sub></form><legend id='a8TpU'></legend><bdo id='a8TpU'><pre id='a8TpU'><center id='a8TpU'></center></pre></bdo></b><th id='a8TpU'></th></span></q></dt></tr></i><div id='a8TpU'><tfoot id='a8TpU'></tfoot><dl id='a8TpU'><fieldset id='a8TpU'></fieldset></dl></div>

        <small id='a8TpU'></small><noframes id='a8TpU'>

      1. Javascript 在模态窗口关闭时停止 HTML5 视频播放

        Javascript to stop HTML5 video playback on modal window close(Javascript 在模态窗口关闭时停止 HTML5 视频播放)
        <legend id='wMgtW'><style id='wMgtW'><dir id='wMgtW'><q id='wMgtW'></q></dir></style></legend>
            <bdo id='wMgtW'></bdo><ul id='wMgtW'></ul>
              <tbody id='wMgtW'></tbody>
              <i id='wMgtW'><tr id='wMgtW'><dt id='wMgtW'><q id='wMgtW'><span id='wMgtW'><b id='wMgtW'><form id='wMgtW'><ins id='wMgtW'></ins><ul id='wMgtW'></ul><sub id='wMgtW'></sub></form><legend id='wMgtW'></legend><bdo id='wMgtW'><pre id='wMgtW'><center id='wMgtW'></center></pre></bdo></b><th id='wMgtW'></th></span></q></dt></tr></i><div id='wMgtW'><tfoot id='wMgtW'></tfoot><dl id='wMgtW'><fieldset id='wMgtW'></fieldset></dl></div>

              • <small id='wMgtW'></small><noframes id='wMgtW'>

                <tfoot id='wMgtW'></tfoot>

                • 本文介绍了Javascript 在模态窗口关闭时停止 HTML5 视频播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在模态窗口上有一个 html5 视频元素.当我关闭窗口时,视频继续播放.我是 JS 的新手.有没有一种简单的方法可以将视频播放停止功能绑定到窗口关闭按钮?下面是我的html页面:

                  I've got a html5 video element on a modal window. When I close the window the video continues to play. I'm a total newbie to JS. Is there an easy way to tie a video playback stop function to the window close button? Below is my html page:

                  <!DOCTYPE html >
                  <html lang="en">
                  
                  <head>
                  <meta charset="utf-8" />
                  <title>Modal Test</title>
                  
                  <script type="text/javascript" src="jquery.js">
                  
                  </script>
                  
                  <script type="text/javascript">
                      $(document).ready(function(){
                          $("#showSimpleModal").click(function() {
                              $("div#simpleModal").addClass("show");
                              return false;   
                          });
                  
                          $("#closeSimple").click(function() {
                              $("div#simpleModal").removeClass("show");
                              return false;                   
                          });
                      });
                  </script>
                  
                  <style type="text/css">
                  
                  div#simpleModal
                  {
                      position:absolute; 
                      top: 40px; 
                      width: 320px; 
                      left: 170px; 
                      border: solid 1px #bbb;     
                      padding: 20px; 
                      background: #fff; 
                      -webkit-box-shadow: 0px 3px 6px rgba(0,0,0,0.25); 
                      opacity: 0.0; 
                      -webkit-transition: opacity 0.0s ease-out; z-index: 0;
                  }
                  
                  div#simpleModal.show
                  {
                      opacity: 1.0; 
                      z-index: 100;        
                      -webkit-transition-duration: 0.25s; 
                  }
                  
                  </style>
                  </head>
                  <body>
                  
                  <a href="" id="showSimpleModal">Show Modal</a>
                  
                  <div id="simpleModal" class="modal">
                  <video width="320"  height="240" src="Davis_5109iPadFig3.m4v" controls="controls"> </video>
                  <a href="" id="closeSimple">Close</a>
                  </div>
                  </body>
                  </html>
                  

                  非常感谢任何输入.

                  谢谢.

                  推荐答案

                  我正在使用以下技巧来停止 HTML5 视频.pause() 关闭模态视频并设置 currentTime = 0;

                  I'm using the following trick to stop HTML5 video. pause() the video on modal close and set currentTime = 0;

                  <script>
                       var video = document.getElementById("myVideoPlayer");
                       function stopVideo(){
                            video.pause();
                            video.currentTime = 0;
                       }
                  </script>
                  

                  现在您可以使用 stopVideo() 方法停止 HTML5 视频.喜欢,

                  Now you can use stopVideo() method to stop HTML5 video. Like,

                  $("#stop").on('click', function(){
                      stopVideo();
                  });
                  

                  这篇关于Javascript 在模态窗口关闭时停止 HTML5 视频播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What are valid deviceNames for Chrome emulation testing with Protractor?(使用 Protractor 进行 Chrome 模拟测试的有效设备名称是什么?)
                  Protractor Check if Element Does Not Exist(量角器检查元素是否不存在)
                  Protractor e2e Tests Login Redirection(Protractor e2e 测试登录重定向)
                  Explain about async/ await in Protractor(解释 Protractor 中的 async/await)
                  Protractor browser.wait doesn#39;t wait(量角器 browser.wait 不等待)
                  How to use Protractor with Angular 2?(如何在 Angular 2 中使用量角器?)
                    <tbody id='BzITf'></tbody>
                  <legend id='BzITf'><style id='BzITf'><dir id='BzITf'><q id='BzITf'></q></dir></style></legend>

                  <small id='BzITf'></small><noframes id='BzITf'>

                      <tfoot id='BzITf'></tfoot>
                          <bdo id='BzITf'></bdo><ul id='BzITf'></ul>
                        • <i id='BzITf'><tr id='BzITf'><dt id='BzITf'><q id='BzITf'><span id='BzITf'><b id='BzITf'><form id='BzITf'><ins id='BzITf'></ins><ul id='BzITf'></ul><sub id='BzITf'></sub></form><legend id='BzITf'></legend><bdo id='BzITf'><pre id='BzITf'><center id='BzITf'></center></pre></bdo></b><th id='BzITf'></th></span></q></dt></tr></i><div id='BzITf'><tfoot id='BzITf'></tfoot><dl id='BzITf'><fieldset id='BzITf'></fieldset></dl></div>