Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Header Overlaps Content on Scroll - Needs Fixed Positioning #68

Closed
wants to merge 1 commit into from
Closed
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
16 changes: 16 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,22 @@ <h1 style="font-family: var(--ff-philosopher);color: brown;z-index: 99;">Welcome
window.open('Html-files/menu.html', '_blank');
});
</script>

<!-- New additions for navbar -->
<script>
window.addEventListener('scroll', function() {
const navbar = document.getElementById('top');
if (window.scrollY > 250) { // Adjust value for when the navbar becomes solid
navbar.style.backgroundColor = 'rgb(176, 63, 63)'; // Add background color when scrolling
navbar.style.transition = 'background-color 1s ease-in-out';
} else {
navbar.style.backgroundColor = 'transparent'; // Make it transparent when scrolled to top
navbar.style.transition = 'background-color 0.3s ease-in-out';
}
});
</script>


<section class="about_us">
<div class="move">
<div id="marque">
Expand Down
9 changes: 7 additions & 2 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ body {
}

.navbar {
background-color: transparent; /* Initial transparent background */
transition: background-color 1s ease-in-out, backdrop-filter 0.3s, color 0.3s; /* Smooth transition for color change*/
padding: 8px 0px;
height: 60px;
transition: background-color 0.3s, backdrop-filter 0.3s, color 0.3s; /* Added transitions for smooth color change */
position: fixed; /* Keep it at the top */
top: 0;
width: 100%;
z-index: 1000; /* Ensure it stays above other elements */
height: 80px;
backdrop-filter: blur(0); /* Initially no blur */
}

Expand Down