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
11 changes: 11 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@

<!-- Todo: read the following HTML Todos to create your stunning portfolio website -->
<body>
<nav class="navbar">
<div class="container">
<a href="#hero" class="nav-logo">My Portfolio</a>
<ul class="nav-menu">
<li><a href="#hero" class="nav-link">Home</a></li>
<li><a href="#about" class="nav-link">About Me</a></li>
<li><a href="#projects" class="nav-link">Projects</a></li>
<li><a href="#contact" class="nav-link">Contact</a></li>
</ul>
</div>
</nav>
<div id="top"></div>

<!-- **** Hero Section **** -->
Expand Down
23 changes: 23 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,26 @@ import { targetElements, defaultProps } from "./data/scrollRevealConfig";

initScrollReveal(targetElements, defaultProps);
initTiltEffect();

document.addEventListener("DOMContentLoaded", function () {
const navbar = document.querySelector(".navbar");
let lastScrollTop = 0;

window.addEventListener("scroll", function () {
let scrollTop = window.scrollY;

if (scrollTop > 50) {
navbar.classList.add("scrolled");
} else {
navbar.classList.remove("scrolled");
}

if (scrollTop > lastScrollTop) {
navbar.classList.add("hidden");
} else {
navbar.classList.remove("hidden");
}

lastScrollTop = scrollTop;
});
});
58 changes: 58 additions & 0 deletions src/sass/layout/_navbar.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
.navbar {
position: fixed;
width: 100%;
top: 0;
left: 0;
padding: 15px 0;
z-index: 1000;
transition: background 0.3s ease-in-out, top 0.3s ease-in-out;
background: transparent;

.container {
display: flex;
justify-content: space-between;
align-items: center;
max-width: 1200px;
margin: 0 auto;
}

.nav-logo {
color: #000000;
font-size: 2rem;
font-weight: bold;
text-decoration: none;
}

.nav-menu {
list-style: none;
display: flex;
gap: 20px;

li {
display: inline;
}

.nav-link {
font-family:Montserrat;
color: #149cb7;
text-decoration: none;
font-size: 1.4rem;
transition: color 0.3s;
font-weight: 400;

&:hover {
color: #0d00ff;
}
}
}

}

.navbar.scrolled {
background: rgba(255, 255, 255, 0.8);
}

.navbar.hidden {
top: -100px;
}

1 change: 1 addition & 0 deletions src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

@import "./sass/layout/footer";
@import "./sass/layout/sections";
@import "./sass/layout/navbar";

@import "./sass/sections/about";
@import "./sass/sections/contact";
Expand Down