javascript - HTML <video> function if videoEnded go to other section of the page -
i have page here shows video @ load. trying achieve is; if video has ended, go other section of page (like button does).
http://i333180.iris.fhict.nl/p2_vc/#section1
already collected code internet couldn't make functional. didn't found problem tho.
html
<!-- video --> <video id="moodvideo" autoplay controls onended="videoended()"> <source src="moodvideo.mp4" type='video/mp4'> </video>
js
function videoended() { //go hreff="#section" }
html
<video id="moodvideo" autoplay controls onended="videoended()" src="moodvideo.mp4"></video>
script:
<script type="text/javascript"> function videoended() { window.location.href="http://i333180.iris.fhict.nl/p2_vc/#section"; } </script>
since it's referring section on same page simplify thing passing section name argument method.
<script type="text/javascript"> function videoended(sectionname) { window.location.href=window.location.pathname+"/#"+sectionname; } </script>
Comments
Post a Comment