Created
June 8, 2021 07:27
-
-
Save kvasdopil/040f71a3e1f6bb94caa69371aca0fc87 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body style="padding:0;margin:0"> | |
<div> | |
<video id="a" src="red.mp4" | |
style="height:100vh" autoplay></video> | |
<video id="b" src="gron.mp4" | |
style="height:100vh;display:none"></video> | |
</div> | |
<script> | |
const v1 = document.querySelector('#a'); | |
const v2 = document.querySelector('#b'); | |
document.querySelector('#a').onclick = () => v1.play(); | |
v1.onended = () => { | |
v2.style = "position:absolute;height:100vh"; | |
v1.style = "display:none"; | |
v2.play(); | |
v1.currentTime = 0; | |
} | |
v2.onended = () => { | |
v1.style = "position:absolute;height:100vh"; | |
v2.style = "display:none"; | |
v1.play(); | |
v2.currentTime = 0; | |
} | |
</script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment