Javascript to stop HTML5 video playback on modal window close -


i've got html5 video element on modal window. when close window video continues play. i'm total newbie js. there easy way tie video playback stop function window close button? below 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> 

any input appreciated.

thanks.

i'm not sure whether zohogorganzola's solution correct; however, may want try getting @ element directly rather trying invoke method on jquery collection, instead of

$("#videocontainer").pause(); 

try

$("#videocontainer")[0].pause(); 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -