0

enter image description here

As shown in the GIF, there is an overlay that appears before clicking on the YouTube video. I want to show an image before clicking on the video, and when clicked, the image disappears and the video starts playing.

How can I implement this on my own webpage?

1 Answers1

0

You can use CSS to do this.

Load both the image and the video when your page, or page segment etc, loads.

Using CSS, overlay the image directly over the video.

When the user clicks on the image, use the click handler to alter the CSS and hide the image or move it behind the video.

You can see examples of CSS overlap approaches with some quick searches - e.g. https://stackoverflow.com/a/21086525/334402 and https://www.w3schools.com/howto/howto_css_image_overlay_title.asp

Mick
  • 24,231
  • 1
  • 54
  • 120