Skip to content

#326: Solution for a Video Popup Modal#329

Merged
sumn2u merged 3 commits intosumn2u:mainfrom
soonu-kedari:main
Oct 5, 2025
Merged

#326: Solution for a Video Popup Modal#329
sumn2u merged 3 commits intosumn2u:mainfrom
soonu-kedari:main

Conversation

@soonu-kedari
Copy link
Copy Markdown
Contributor

Below concepts used in the Example:
Modal: A container overlaying the page for focused content
Event Listeners: Detects clicks or key presses
Video Control: Using .play(), .pause(), .current Time to manage playback
CSS Overlay: Covers the page for modal background
Responsive Design: Adapts layout to fit different devices

@vercel
Copy link
Copy Markdown

vercel Bot commented Oct 5, 2025

@soonu-kedari is attempting to deploy a commit to the Suman Kunwar's projects Team on Vercel.

A member of the Team first needs to authorize it.

@sumn2u sumn2u requested a review from Copilot October 5, 2025 10:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a video popup modal component for displaying video trailers with a movie card interface. The solution includes HTML structure, CSS styling with responsive design, and JavaScript functionality for modal interactions and video controls.

  • Adds a complete video modal popup system with movie card UI
  • Implements responsive design for mobile and tablet devices
  • Includes JavaScript event handling for modal open/close and video playback controls

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
examples/video-popup/index.html HTML structure with movie card and modal elements
examples/video-popup/style.css CSS styling with responsive breakpoints and animations
examples/video-popup/script.js JavaScript for modal interactions and video controls
examples/video-popup/README.md Documentation explaining the implementation and features

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread examples/video-popup/style.css Outdated
margin: 10px 0 5px;
}

.popup-title{
Copy link

Copilot AI Oct 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space before opening brace. Should be .popup-title { to follow consistent CSS formatting.

Suggested change
.popup-title{
.popup-title {

Copilot uses AI. Check for mistakes.
Comment thread examples/video-popup/style.css Outdated
/* Modal overlay */
.modal {
position: fixed;
top: 0; left: 0;
Copy link

Copilot AI Oct 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] CSS properties should be on separate lines for better readability and maintainability.

Suggested change
top: 0; left: 0;
top: 0;
left: 0;

Copilot uses AI. Check for mistakes.
Comment thread examples/video-popup/README.md Outdated
The `index.html` file defines the structure of the webpage. It includes:

#### **Key Elements**
- `<div class="movie-container">` — Wraps all content like the movie thumbnail, title, description, and button.
Copy link

Copilot AI Oct 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The class name 'movie-container' doesn't match the actual implementation which uses 'movie-card'. This should be updated to reflect the correct class name.

Suggested change
- `<div class="movie-container">` — Wraps all content like the movie thumbnail, title, description, and button.
- `<div class="movie-card">` — Wraps all content like the movie thumbnail, title, description, and button.

Copilot uses AI. Check for mistakes.
Comment thread examples/video-popup/README.md Outdated
- `<img>` — Displays the movie’s thumbnail or poster image.
- `<h1>` — The movie title.
- `<p>` — A short movie description or tagline.
- `<button id="openModal">` — Button to trigger the modal popup.
Copy link

Copilot AI Oct 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ID 'openModal' doesn't match the actual implementation which uses 'openModalBtn'. This should be updated to reflect the correct ID.

Suggested change
- `<button id="openModal">` — Button to trigger the modal popup.
- `<button id="openModalBtn">` — Button to trigger the modal popup.

Copilot uses AI. Check for mistakes.
Comment thread examples/video-popup/README.md Outdated
Comment on lines +95 to +97
const btn = document.getElementById("openModal");
const span = document.getElementsByClassName("close")[0];
const video = document.getElementById("trailerVideo");
Copy link

Copilot AI Oct 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example code uses incorrect element IDs and class names that don't match the actual implementation. Should use 'openModalBtn', 'closeModalBtn', and 'trailer' respectively.

Suggested change
const btn = document.getElementById("openModal");
const span = document.getElementsByClassName("close")[0];
const video = document.getElementById("trailerVideo");
const btn = document.getElementById("openModalBtn");
const span = document.getElementById("closeModalBtn");
const video = document.getElementById("trailer");

Copilot uses AI. Check for mistakes.
@sumn2u
Copy link
Copy Markdown
Owner

sumn2u commented Oct 5, 2025

@soonu-kedari When you have time can you look into above comments?

@soonu-kedari
Copy link
Copy Markdown
Contributor Author

@sumn2u Fixed the comments

@sumn2u sumn2u requested a review from Copilot October 5, 2025 11:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread examples/video-popup/style.css Outdated
body {
font-family: Arial, sans-serif;
background: #ffffff;
color: #fff;
Copy link

Copilot AI Oct 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The body has a white background (#ffffff) but white text color (#fff), making the text invisible. This should be corrected to use a dark text color like #333 or change the background to a dark color.

Suggested change
color: #fff;
color: #333;

Copilot uses AI. Check for mistakes.
Comment thread examples/video-popup/README.md Outdated
- `<p>` — A short movie description or tagline.
- `<button id="openModalBtn">` — Button to trigger the modal popup.
- `<div id="videoModal" class="modal">` — The modal container that holds the video player.
- `<span class="close">&times;</span>` — The close icon (×) used to close the modal.
Copy link

Copilot AI Oct 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation shows the close button as a <span> element with class 'close', but the actual implementation uses a <button> element with class 'close-btn' and id 'closeModalBtn'.

Suggested change
- `<span class="close">&times;</span>` — The close icon (×) used to close the modal.
- `<button class="close-btn" id="closeModalBtn">&times;</button>` — The close icon (×) used to close the modal.

Copilot uses AI. Check for mistakes.
Comment thread examples/video-popup/README.md Outdated
Comment on lines +103 to +128
btn.onclick = function() {
modal.style.display = "flex";
video.play();
}
```
When the **Play Trailer** button is clicked, this function makes the modal visible and starts playing the video.

3. **Close Modal Functionality**
```js
span.onclick = function() {
modal.style.display = "none";
video.pause();
video.currentTime = 0;
}
```
When the close icon (×) is clicked, the modal hides, the video pauses, and the playback resets.

4. **Outside Click Close**
```js
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
video.pause();
video.currentTime = 0;
}
}
Copy link

Copilot AI Oct 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation shows outdated code using onclick property and style.display, but the actual implementation uses addEventListener and CSS classes with classList.add('active').

Suggested change
btn.onclick = function() {
modal.style.display = "flex";
video.play();
}
```
When the **Play Trailer** button is clicked, this function makes the modal visible and starts playing the video.
3. **Close Modal Functionality**
```js
span.onclick = function() {
modal.style.display = "none";
video.pause();
video.currentTime = 0;
}
```
When the close icon (×) is clicked, the modal hides, the video pauses, and the playback resets.
4. **Outside Click Close**
```js
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
video.pause();
video.currentTime = 0;
}
}
btn.addEventListener('click', function() {
modal.classList.add('active');
video.play();
});

When the Play Trailer button is clicked, this function makes the modal visible and starts playing the video.

  1. Close Modal Functionality

    span.addEventListener('click', function() {
        modal.classList.remove('active');
        video.pause();
        video.currentTime = 0;
    });

    When the close icon (×) is clicked, the modal hides, the video pauses, and the playback resets.

  2. Outside Click Close

    window.addEventListener('click', function(event) {
        if (event.target === modal) {
            modal.classList.remove('active');
            video.pause();
            video.currentTime = 0;
        }
    });

Copilot uses AI. Check for mistakes.
Comment thread examples/video-popup/README.md Outdated
Comment on lines +103 to +128
btn.onclick = function() {
modal.style.display = "flex";
video.play();
}
```
When the **Play Trailer** button is clicked, this function makes the modal visible and starts playing the video.

3. **Close Modal Functionality**
```js
span.onclick = function() {
modal.style.display = "none";
video.pause();
video.currentTime = 0;
}
```
When the close icon (×) is clicked, the modal hides, the video pauses, and the playback resets.

4. **Outside Click Close**
```js
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
video.pause();
video.currentTime = 0;
}
}
Copy link

Copilot AI Oct 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation shows outdated code using window.onclick and style.display, but the actual implementation uses modal.addEventListener and classList.remove('active').

Suggested change
btn.onclick = function() {
modal.style.display = "flex";
video.play();
}
```
When the **Play Trailer** button is clicked, this function makes the modal visible and starts playing the video.
3. **Close Modal Functionality**
```js
span.onclick = function() {
modal.style.display = "none";
video.pause();
video.currentTime = 0;
}
```
When the close icon (×) is clicked, the modal hides, the video pauses, and the playback resets.
4. **Outside Click Close**
```js
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
video.pause();
video.currentTime = 0;
}
}
btn.addEventListener("click", function() {
modal.classList.add("active");
video.play();
});

When the Play Trailer button is clicked, this function makes the modal visible and starts playing the video.

  1. Close Modal Functionality

    span.addEventListener("click", function() {
        modal.classList.remove("active");
        video.pause();
        video.currentTime = 0;
    });

    When the close icon (×) is clicked, the modal hides, the video pauses, and the playback resets.

  2. Outside Click Close

    modal.addEventListener("click", function(event) {
        if (event.target === modal) {
            modal.classList.remove("active");
            video.pause();
            video.currentTime = 0;
        }
    });

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner

@sumn2u sumn2u left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice Work!
Image

Image

@sumn2u
Copy link
Copy Markdown
Owner

sumn2u commented Oct 5, 2025

Fixes #326

@sumn2u sumn2u merged commit 93670d9 into sumn2u:main Oct 5, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants