简体   繁体   中英

Javascript to stop HTML5 video playback on 'injected' html code

I know that are several topics resolved here that is very similar with my problem, but believe me that I try everything and nothing was worked for me.
So first of all, I have a landpage here: http://styvconcept.zz.mu/projects/ovidiu/index.html
On the portfolio section, I have cople of projects listed, when you click on a video project (last two), it's open "injected" a html file, that is showing the project details with a video playback too.
Below this details is a "X" button, when you click it will close the project details.
And here my problem come, the playback of the video is still running and is very annoying the sound from the video.
I want to stop the video playback on that "X" buttom click. If someone can help me out of this I will more than thankful!

You need to pause the video player when hiding the element.

JavaScript:

document.getElementById("player").pause();

jQuery:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM