Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions video_bg/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel = "icon" href ="iconfinder_16769_blackhole_eclipse_star_sun_icon_128px.png" type = "image/x-icon">
<link rel="stylesheet" href="style.css">
<title>SpaceX 2.o</title>
</head>
<body>
<section class="showcase">

<header>
<h2 class="logo">Vikram</h2>
<div class="toggle"></div>
</header>
<video id="bgVideo" src="bg.mp4" muted loop autoplay></video>
<button id="muteBtn">Unmute</button>

<div class="overlay"></div>
<div class="text">
<h2>Never Stop</h2>
<h3>Exploring The World</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat.</p>
<a href="#">Explore</a>
</div>
<ul class="social">
<li><a href="#"><img src="https://i.ibb.co/x7P24fL/facebook.png"></a></li>
<li><a href="#"><img src="https://i.ibb.co/Wnxq2Nq/twitter.png"></a></li>
<li><a href="#"><img src="https://i.ibb.co/ySwtH4B/instagram.png"></a></li>
</ul>
</section>
<div class="menu">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">News</a></li>
<li><a href="#">Destination</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>

<script src="main.js"></script>

</body>
</html>
22 changes: 21 additions & 1 deletion video_bg/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,24 @@ const showcase = document.querySelector('.showcase');
menuToggle.addEventListener('click', () => {
menuToggle.classList.toggle('active');
showcase.classList.toggle('active');
})
})

// Background video mute / unmute
const video = document.getElementById("bgVideo");
const muteBtn = document.getElementById("muteBtn");

muteBtn.addEventListener("click", () => {
// Ensure video is playing after user interaction
if (video.paused) {
video.play();
}

if (video.muted) {
video.muted = false;
muteBtn.textContent = "Mute";
} else {
video.muted = true;
muteBtn.textContent = "Unmute";
}
});

24 changes: 23 additions & 1 deletion video_bg/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,26 @@ header .logo
{
font-size: 2em;
}
}
}

/* ============================= */
/* Mute / Unmute Button Styles */
/* ============================= */

#muteBtn {
position: absolute;
bottom: 20px;
right: 20px;
padding: 10px 16px;
background: rgba(0, 0, 0, 0.6);
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
z-index: 1001; /* MUST be higher than overlay */
}

/* Make sure overlay stays behind clickable elements */
.overlay {
z-index: 1;
}