Open In App

Design Video trailer Popup in HTML CSS & JavaScript

Last Updated : 23 Jul, 2024
Comments
Improve
Suggest changes
6 Likes
Like
Report

This project aims to create a video trailer popup using HTML, CSS and JavaScript. When a user clicks on a button or an image thumbnail a popup window will appear displaying the video trailer. This interactive feature enhances user experience and engagement on websites or web applications.

Preview

a0-(1)

Project Structure:

Screenshot-2023-10-05-222543

Approach / Functionalities:

  • Create a button or image thumbnail to the trigger the popup.
  • Design the popup using CSS to overlay on the top of the webpage.
  • Implement JavaScript to show and hide the popup when the trigger element is clicked.
  • Embed the video trailer inside the popup using the HTML <video> tag or iframe.

Steps to Create and Configure the Project:

  • Create an HTML file for webpage structure.
  • Style the webpage using CSS to the create the popup layout.
  • Write JavaScript code to the handle popup functionality.
  • Embed the video trailer using the HTML <video> tag or iframe.
  • Test the application locally in the web browser.

Example: To demonstrate the working of the video trailer popup using HTML, CSS and JavaScript.

HTML
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>The Video Trailer Popup</title>
    <link rel="stylesheet" href="styles.css" />
</head>

<body>
    <div class="background"></div>
    <button id="popup">Watch Trailer</button>
    <div id="videoPopup1" class="popup">
        <div class="popup-content">
            <span class="close" id="close">×</span>
            <iframe width="560" height="315" 
                    src=
"https://www.youtube.com/embed/MCG7S2fGUeU" 
                    frameborder="0"
                allowfullscreen></iframe>
        </div>
    </div>
    <script src="script.js"></script>
</body>

</html>
CSS JavaScript

Output :


Next Article

Similar Reads