Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

184
Views
Image On Hover Play Video And Reset the div with image on completion

I would like to show thumbnails for videos on load and on hover or touch I want to play the video inside the parent div of the image. On mouseout and video ends, the div should show the image automatically. How can I do it?

In simple, I need a homepage just like youtube page. I will show the images first and on hover it should play or pause respective videos.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Can you try this enter image description here:

var vid = document.getElementById("myVideo"); 
var text = document.getElementById("text"); 
function playVid() { 
  vid.play(); 
  text.innerHTML = "Start Video";
} 

function pauseVid() { 
  vid.pause(); 
  text.innerHTML = "Stop Video";
} 
<!DOCTYPE html> 
<html> 
<body> 
<video muted="muted" id="myVideo" onmouseenter="playVid()" onmouseleave="pauseVid()"> 
  <source src=http://techslides.com/demos/sample-videos/small.webm type=video/webm> 
  <source src=http://techslides.com/demos/sample-videos/small.ogv type=video/ogg> 
  <source src=http://techslides.com/demos/sample-videos/small.mp4 type=video/mp4>
  <source src=http://techslides.com/demos/sample-videos/small.3gp type=video/3gp>
</video>
<p id="text"></p>

</body>
</html>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!