Aashish34 commited on
Commit
2da7131
·
1 Parent(s): 9a81fb2

update ml links

Browse files
Files changed (1) hide show
  1. math-ds-complete/app.js +15 -11
math-ds-complete/app.js CHANGED
@@ -114,17 +114,18 @@ function initNavigation() {
114
  link.addEventListener('click', (e) => {
115
  e.preventDefault();
116
  const topicId = link.getAttribute('data-topic');
117
- const target = document.getElementById(`topic-${topicId}`);
 
118
 
119
- if (target) {
120
- target.scrollIntoView({ behavior: 'smooth', block: 'start' });
121
- updateActiveLink(topicId);
122
-
123
- // Close mobile menu if open
124
- if (window.innerWidth <= 1024) {
125
- sidebar.classList.remove('active');
126
- }
127
- }
128
  });
129
  });
130
  }
@@ -137,7 +138,10 @@ function updateActiveLink(topicId) {
137
  if (activeLink) {
138
  activeLink.classList.add('active');
139
  }
140
- currentTopic = parseInt(topicId);
 
 
 
141
  }
142
 
143
  // ===== SCROLL OBSERVER =====
 
114
  link.addEventListener('click', (e) => {
115
  e.preventDefault();
116
  const topicId = link.getAttribute('data-topic');
117
+ // Handle both regular topics and ML topics
118
+ const target = document.getElementById(topicId.startsWith('ml-') ? topicId : `topic-${topicId}`);
119
 
120
+ if (target) {
121
+ target.scrollIntoView({ behavior: 'smooth', block: 'start' });
122
+ updateActiveLink(topicId);
123
+
124
+ // Close mobile menu if open
125
+ if (window.innerWidth <= 1024) {
126
+ sidebar.classList.remove('active');
127
+ }
128
+ }
129
  });
130
  });
131
  }
 
138
  if (activeLink) {
139
  activeLink.classList.add('active');
140
  }
141
+ // Only update currentTopic if it's a number
142
+ if (!topicId.startsWith('ml-')) {
143
+ currentTopic = parseInt(topicId);
144
+ }
145
  }
146
 
147
  // ===== SCROLL OBSERVER =====