[go: up one dir, main page]

0% found this document useful (0 votes)
23 views7 pages

Netflix Clone Code

Netflix

Uploaded by

djhsjis8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views7 pages

Netflix Clone Code

Netflix

Uploaded by

djhsjis8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

index.

html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MyFlix - Watch Movies</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<div class="logo">MyFlix</div>
<nav>
<ul>
<li>Home</li>
<li>TV Shows</li>
<li>Movies</li>
<li>My List</li>
</ul>
</nav>
</header>

<section class="banner">
<img src="assets/banner.jpg" alt="Banner Image">
<div class="banner-content">
<h1>Featured Movie</h1>
<p>Enjoy this amazing movie today!</p>
<button id="playButton">Play</button>
</div>
</section>

<div id="videoModal" class="modal">


<div class="modal-content">
<span class="close-button">&times;</span>
<video id="videoPlayer" controls>
<source src="assets/video.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</div>
</div>

<section class="movies">
<h2>Trending Now</h2>
<div class="movie-row">
<img src="assets/thumbnail1.jpg" alt="Thumbnail 1">
<img src="assets/thumbnail1.jpg" alt="Thumbnail 2">
<img src="assets/thumbnail1.jpg" alt="Thumbnail 3">
<img src="assets/thumbnail1.jpg" alt="Thumbnail 4">
</div>
</section>
<footer>
<p>&copy; 2024 MyFlix. All Rights Reserved.</p>
</footer>

<script src="script.js"></script>
</body>
</html>
style.css

* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: Arial, sans-serif;
}

body {
background-color: #141414;
color: white;
overflow-x: hidden;
}

header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px 50px;
background-color: rgba(0, 0, 0, 0.8);
position: fixed;
width: 100%;
z-index: 1000;
}

header .logo {
font-size: 2rem;
font-weight: bold;
color: red;
}

header nav ul {
list-style: none;
display: flex;
gap: 20px;
}

header nav ul li {
cursor: pointer;
font-weight: bold;
transition: color 0.3s ease;
}

header nav ul li:hover {


color: #e50914;
}

.banner {
position: relative;
height: 400px;
margin-top: 80px;
background-color: black;
}

.banner img {
width: 100%;
height: 100%;
object-fit: cover;
filter: brightness(0.6);
}

.banner-content {
position: absolute;
bottom: 50px;
left: 50px;
}

.banner-content h1 {
font-size: 2.5rem;
margin-bottom: 10px;
}

.banner-content button {
padding: 10px 20px;
background-color: #e50914;
border: none;
color: white;
cursor: pointer;
transition: opacity 0.3s ease;
}

.banner-content button:hover {
opacity: 0.8;
}

.movies {
padding: 50px;
}

.movies h2 {
margin-bottom: 20px;
}

.movie-row {
display: flex;
gap: 10px;
overflow-x: scroll;
}

.movie-row img {
width: 200px;
border-radius: 5px;
transition: transform 0.3s ease;
cursor: pointer;
}

.movie-row img:hover {
transform: scale(1.1);
}

.modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.8);
justify-content: center;
align-items: center;
}

.modal-content {
position: relative;
width: 80%;
max-width: 800px;
}

video {
width: 100%;
border-radius: 5px;
}

.close-button {
position: absolute;
top: 10px;
right: 15px;
color: white;
font-size: 2rem;
cursor: pointer;
}

footer {
text-align: center;
padding: 20px;
font-size: 0.8rem;
color: gray;
}
script.js

const playButton = document.getElementById("playButton");


const videoModal = document.getElementById("videoModal");
const closeButton = document.querySelector(".close-button");
const videoPlayer = document.getElementById("videoPlayer");

playButton.addEventListener("click", () => {
videoModal.style.display = "flex";
videoPlayer.play();
});

closeButton.addEventListener("click", () => {
videoModal.style.display = "none";
videoPlayer.pause();
});

window.addEventListener("click", (event) => {


if (event.target === videoModal) {
videoModal.style.display = "none";
videoPlayer.pause();
}
});

You might also like