chenguittiMaroua commited on
Commit
9beb60d
·
verified ·
1 Parent(s): 7da5260

Update static/test.js

Browse files
Files changed (1) hide show
  1. static/test.js +24 -28
static/test.js CHANGED
@@ -1,37 +1,33 @@
1
  // Function to show the selected section
2
- function showSection(sectionId) {
3
- // Hide all tool sections first
4
- document.querySelectorAll('.tool-section').forEach(section => {
5
- section.classList.add('hidden');
 
 
 
 
 
 
 
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
- // Initialize - hide all tool sections by default
20
- document.addEventListener('DOMContentLoaded', () => {
21
- // Hide all tool sections
22
  document.querySelectorAll('.tool-section').forEach(section => {
23
- section.classList.add('hidden');
24
  });
25
 
26
- // Set up card click handlers
27
- document.querySelectorAll('.card').forEach(card => {
28
- card.addEventListener('click', function() {
29
- const sectionId = this.getAttribute('onclick').match(/'([^']+)'/)[1];
30
- showSection(sectionId);
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() {