First of all, I'm very new to Javascript but have dabbled a bit, watching videos across the interweb.
I have images that i would like to use as trigger objects to play a video that corresponds to them. Lets say i have 3 images. img1 (vid1) img2 (vid2) img3 (vid3). If I hover above one of the images, play the image that corresponds to it. (I obviously need to reference different videos in my video src)
I am able to hover and play a single video but am unsure how to have multiple sources that can load and play into the html video.
HTML:
<div class = "videoContainer">
<video id="video" src="Videos/Glitch.mp4" height = "180">
<div class ="body">
<div class = "textPresets">
<input class ="glitch" type = "image" src ="Pics/Glitch.png" onmouseover="playVideo()" onmouseout ="pauseVideo()">
<div class="line"></div>
<input class ="gold" type = "image" src ="Pics/Golden-Text_Preview.png" onmouseover="playVideo()" onmouseout = "pauseVideo()">
<div class="line"></div>
<input class ="chrome" type = "image" src ="Pics/Chrome-Text_Preview.png" onmouseover="playVideo()" onmouseout = "pauseVideo()">
</div>
</div>
</div>
JAVASCRIPT:
var myVideo = document.getElementById("video");
function playVideo() {
myVideo.play();
}
function pauseVideo() {
myVideo.pause();
}
Thank you soooo much!