0
Javascript question videos
I have a menu, and when I click on them they are show in a bigger size, but below them I have a button that will be in charge of playing o pausing each video, watch out it is only one button for the three videos, then I wonder how that would be done with javascript, the code I have is only for one: Var myvideo = documento. getElementById("video") ; Function playPause() { If(myvideo.paused) myvideo.play(); Else myvideo.pause(); } I don't know if I can explain in a few words what Code I would use to click on the button to stat the selected video and if I click it again I pause it,if I selected another video the previos one stops and now the new one starts.
2 odpowiedzi
+ 1
Assuming those three vids element with different id are in a div container ,listen for onselect event on div and when you will click or select a video ,get the target id like e.target.id (e.currentTarget is div)
Now since you have id use the function above to select it by that id and you are done ,
0
In your pc browser put this link http://agenciaselite.000webhostapp.com/galeria2.html and tell me some clue of what would help me with the objetive.