Spaces:
Sleeping
Sleeping
Update static/test.js
Browse files- static/test.js +24 -28
static/test.js
CHANGED
|
@@ -1,37 +1,33 @@
|
|
| 1 |
// Function to show the selected section
|
| 2 |
-
function
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
});
|
| 7 |
-
|
| 8 |
-
// Show the selected section
|
| 9 |
-
const activeSection = document.getElementById(sectionId);
|
| 10 |
-
if (activeSection) {
|
| 11 |
-
activeSection.classList.remove('hidden');
|
| 12 |
-
activeSection.scrollIntoView({
|
| 13 |
-
behavior: 'smooth',
|
| 14 |
-
block: 'start'
|
| 15 |
-
});
|
| 16 |
-
}
|
| 17 |
-
}
|
| 18 |
|
| 19 |
-
//
|
| 20 |
-
|
| 21 |
-
// Hide all
|
| 22 |
document.querySelectorAll('.tool-section').forEach(section => {
|
| 23 |
-
|
| 24 |
});
|
| 25 |
|
| 26 |
-
//
|
| 27 |
-
document.
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
|
| 36 |
// Function to go back to cards view
|
| 37 |
function showCards() {
|
|
|
|
| 1 |
// Function to show the selected section
|
| 2 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 3 |
+
// Hide all tool sections initially
|
| 4 |
+
document.querySelectorAll('.tool-section').forEach(section => {
|
| 5 |
+
section.classList.add('hidden');
|
| 6 |
+
});
|
| 7 |
+
|
| 8 |
+
// Add click event listeners to all cards
|
| 9 |
+
document.querySelectorAll('.card').forEach(card => {
|
| 10 |
+
card.addEventListener('click', function() {
|
| 11 |
+
const sectionId = this.getAttribute('data-section');
|
| 12 |
+
showSection(sectionId);
|
| 13 |
});
|
| 14 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
+
// Function to show a specific section
|
| 17 |
+
function showSection(sectionId) {
|
| 18 |
+
// Hide all sections first
|
| 19 |
document.querySelectorAll('.tool-section').forEach(section => {
|
| 20 |
+
section.classList.add('hidden');
|
| 21 |
});
|
| 22 |
|
| 23 |
+
// Show the selected section
|
| 24 |
+
const sectionToShow = document.getElementById(sectionId);
|
| 25 |
+
if (sectionToShow) {
|
| 26 |
+
sectionToShow.classList.remove('hidden');
|
| 27 |
+
sectionToShow.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
});
|
|
|
|
| 31 |
|
| 32 |
// Function to go back to cards view
|
| 33 |
function showCards() {
|