Skip to content

Commit

Permalink
Navbar CSS fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
sau-mili committed Jun 6, 2024
1 parent 6992b08 commit 886543f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
30 changes: 28 additions & 2 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1272,19 +1272,45 @@ div.card {

/* Navbar section */
.navbar {
background: rgba(0, 0, 0, 0.7);
/* background: rgba(0, 0, 0, 0.7); */
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 1000;
}


.navbar nav {
position:fixed;
background: rgba(0, 0, 0, 0.7);
color: white;
display: flex;
align-items: center;
justify-content: space-between;
height: 80px;
height: 90px;
top: 0;
left: 0;
width:100%;
padding: 20px 0px;
border:none;
transition: all 0.6s;
}
.navbar nav.sticky{
height:80px;
background: linear-gradient(rgb(183, 123, 27),rgba(249, 177, 43, 0.818));
color:white !important;
/* border-bottom: 1.5px solid rgb(0, 0, 0); */
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
box-shadow: 0 0 2px 2px rgb(78, 38, 17, 0.8);
padding: 10px 0px;
}
.navbar nav ul li i{
filter:invert(1);
}
.navbar nav.sticky ul li i{
filter:invert(0);
}

.navbar .logo {
Expand Down
6 changes: 6 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}
</script>
<script type="text/javascript">
window.addEventListener("scroll", function(){
var header= document.querySelector("nav");
header.classList.toggle("sticky", window.scrollY >50)
})
</script>

<!-- Navbar -->
Expand Down

0 comments on commit 886543f

Please sign in to comment.