I have the following code that I tried in W3 html editor:
The main goal: (The code pretty much plays a mp4 video and allows the user to pause/play by clicking on the video screen - no controls are shown) It works fine in a html file.
Now I wanna add this code in my wordpress website, but the section doesn't work. I went to the wordpress help section to try to incorporate Javascript into my website. Their instructions a are giving me a headache as I'm just a newbie at this. I'm not a web developer so to me some of the instructions that I saw are not obvious to follow. If somebody could give me a little step-by-step method to make this code below work in wordpress. I would really appreciate :) thanks!
PS: I'm using WordPress Version 4.3.1
<!DOCTYPE html>
<html>
<body>
<! Within the WordPress text editor, there's no need for the <html> & <body> tags >
<video id="myVideo" width="320" height="176" autoplay>
<source src="http://ift.tt/1apVPR7" type="video/mp4">
Your browser does not support HTML5 video.
</video>
<script type="text/javascript">
var vid = document.getElementById("myVideo");
var isPlaying = true;
vid.onclick = function playVid() {
if (isPlaying == false){
myVideo.play();
isPlaying = true;}
else if (isPlaying == true){
myVideo.pause();
isPlaying = false; }
}
</script>
<! Within the WordPress text editor, there's no need for the <html> & <body> tags >
</body>
</html>
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire