Spaces:
Running
Running
Update projects.html
Browse files- projects.html +14 -16
projects.html
CHANGED
|
@@ -1156,26 +1156,24 @@ function updatePortfolioStats() {
|
|
| 1156 |
}
|
| 1157 |
}
|
| 1158 |
|
| 1159 |
-
// Function to add smooth scrolling for navigation
|
| 1160 |
function addSmoothScrolling() {
|
| 1161 |
-
|
| 1162 |
-
|
| 1163 |
-
|
| 1164 |
-
|
| 1165 |
-
|
| 1166 |
-
|
| 1167 |
-
|
| 1168 |
-
|
| 1169 |
-
|
| 1170 |
-
|
| 1171 |
-
|
| 1172 |
-
|
| 1173 |
-
}
|
| 1174 |
-
}
|
| 1175 |
-
});
|
| 1176 |
});
|
|
|
|
| 1177 |
}
|
| 1178 |
|
|
|
|
| 1179 |
// Function to add header scroll effect
|
| 1180 |
function addHeaderScrollEffect() {
|
| 1181 |
const header = document.querySelector('header');
|
|
|
|
| 1156 |
}
|
| 1157 |
}
|
| 1158 |
|
|
|
|
| 1159 |
function addSmoothScrolling() {
|
| 1160 |
+
const navLinks = document.querySelectorAll('.nav-links a');
|
| 1161 |
+
navLinks.forEach(link => {
|
| 1162 |
+
link.addEventListener('click', function(e) {
|
| 1163 |
+
const href = this.getAttribute('href');
|
| 1164 |
+
if (href.startsWith('#')) {
|
| 1165 |
+
e.preventDefault();
|
| 1166 |
+
const targetEl = document.querySelector(href);
|
| 1167 |
+
if (targetEl) {
|
| 1168 |
+
targetEl.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
| 1169 |
+
}
|
| 1170 |
+
}
|
| 1171 |
+
// else: do nothing, so the link follows through normally
|
|
|
|
|
|
|
|
|
|
| 1172 |
});
|
| 1173 |
+
});
|
| 1174 |
}
|
| 1175 |
|
| 1176 |
+
|
| 1177 |
// Function to add header scroll effect
|
| 1178 |
function addHeaderScrollEffect() {
|
| 1179 |
const header = document.querySelector('header');
|