pranit144 commited on
Commit
8ed1c0f
·
verified ·
1 Parent(s): 627aa22

Update projects.html

Browse files
Files changed (1) hide show
  1. 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
- const navLinks = document.querySelectorAll('.nav-links a');
1162
- navLinks.forEach(link => {
1163
- link.addEventListener('click', function(e) {
1164
- e.preventDefault();
1165
- const targetId = this.getAttribute('href');
1166
- if (targetId.startsWith('#')) {
1167
- const targetElement = document.querySelector(targetId);
1168
- if (targetElement) {
1169
- targetElement.scrollIntoView({
1170
- behavior: 'smooth',
1171
- block: 'start'
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');