SebPirisi877 commited on
Commit
d403c2f
·
verified ·
1 Parent(s): 3aa5f2e

Il tasto della lingua (IT/EN) non funziona - Follow Up Deployment

Browse files
Files changed (1) hide show
  1. index.html +58 -15
index.html CHANGED
@@ -63,10 +63,16 @@
63
  <button class="bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-md font-medium transition duration-300">
64
  Sign Up
65
  </button>
66
- <button class="flex items-center space-x-1 bg-gray-100 hover:bg-gray-200 px-3 py-2 rounded-md transition duration-300">
67
- <i class="fas fa-globe text-gray-700"></i>
68
- <span class="text-sm font-medium">IT/EN</span>
69
- </button>
 
 
 
 
 
 
70
  <button class="md:hidden text-gray-700" id="mobile-menu-button">
71
  <i class="fas fa-bars text-xl"></i>
72
  </button>
@@ -78,9 +84,15 @@
78
  <a href="#how-it-works" class="block py-2 text-gray-700 hover:text-green-600">How It Works</a>
79
  <a href="#courses" class="block py-2 text-gray-700 hover:text-green-600">Courses</a>
80
  <a href="#testimonials" class="block py-2 text-gray-700 hover:text-green-600">Testimonials</a>
81
- <div class="flex items-center py-2">
82
- <i class="fas fa-globe text-gray-700 mr-2"></i>
83
- <span class="text-gray-700">IT/EN</span>
 
 
 
 
 
 
84
  </div>
85
  </div>
86
  </nav>
@@ -546,16 +558,47 @@
546
 
547
  <!-- Language Switcher Script -->
548
  <script>
549
- document.querySelectorAll('[class*="language-switcher"]').forEach(button => {
550
- button.addEventListener('click', function() {
551
- // This would toggle between language versions in a real implementation
552
- alert('Language switching functionality would be implemented here');
553
- // In a real app, you would:
554
- // 1. Store language preference
555
- // 2. Reload page with translated content
556
- // 3. Or fetch translations via AJAX
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
557
  });
558
  });
 
 
 
 
 
 
 
 
 
559
  </script>
560
 
561
  <!-- Mobile Menu Toggle Script -->
 
63
  <button class="bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-md font-medium transition duration-300">
64
  Sign Up
65
  </button>
66
+ <div class="relative">
67
+ <button id="language-switcher" class="flex items-center space-x-1 bg-gray-100 hover:bg-gray-200 px-3 py-2 rounded-md transition duration-300">
68
+ <i class="fas fa-globe text-gray-700"></i>
69
+ <span class="text-sm font-medium">IT/EN</span>
70
+ </button>
71
+ <div id="language-dropdown" class="hidden absolute right-0 mt-2 w-32 bg-white rounded-md shadow-lg z-50">
72
+ <a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" data-lang="it">Italiano</a>
73
+ <a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" data-lang="en">English</a>
74
+ </div>
75
+ </div>
76
  <button class="md:hidden text-gray-700" id="mobile-menu-button">
77
  <i class="fas fa-bars text-xl"></i>
78
  </button>
 
84
  <a href="#how-it-works" class="block py-2 text-gray-700 hover:text-green-600">How It Works</a>
85
  <a href="#courses" class="block py-2 text-gray-700 hover:text-green-600">Courses</a>
86
  <a href="#testimonials" class="block py-2 text-gray-700 hover:text-green-600">Testimonials</a>
87
+ <div class="py-2">
88
+ <div class="flex items-center py-1">
89
+ <i class="fas fa-globe text-gray-700 mr-2"></i>
90
+ <a href="#" class="text-gray-700 hover:text-green-600" data-lang="it">Italiano</a>
91
+ </div>
92
+ <div class="flex items-center py-1">
93
+ <i class="fas fa-globe text-gray-700 mr-2"></i>
94
+ <a href="#" class="text-gray-700 hover:text-green-600" data-lang="en">English</a>
95
+ </div>
96
  </div>
97
  </div>
98
  </nav>
 
558
 
559
  <!-- Language Switcher Script -->
560
  <script>
561
+ // Toggle dropdown menu
562
+ document.getElementById('language-switcher').addEventListener('click', function(e) {
563
+ e.stopPropagation();
564
+ document.getElementById('language-dropdown').classList.toggle('hidden');
565
+ });
566
+
567
+ // Close dropdown when clicking elsewhere
568
+ document.addEventListener('click', function() {
569
+ document.getElementById('language-dropdown').classList.add('hidden');
570
+ });
571
+
572
+ // Handle language selection
573
+ document.querySelectorAll('[data-lang]').forEach(link => {
574
+ link.addEventListener('click', function(e) {
575
+ e.preventDefault();
576
+ const lang = this.getAttribute('data-lang');
577
+
578
+ // In a real implementation, you would:
579
+ // 1. Store the language preference in localStorage
580
+ localStorage.setItem('preferredLanguage', lang);
581
+
582
+ // 2. Either:
583
+ // - Reload the page with the new language version
584
+ // - Or fetch translations via AJAX and update the page
585
+
586
+ // For this example, we'll just show a confirmation
587
+ alert(`Language changed to ${lang === 'it' ? 'Italian' : 'English'}. In a real implementation, the page would update.`);
588
+
589
+ // Close dropdown
590
+ document.getElementById('language-dropdown').classList.add('hidden');
591
  });
592
  });
593
+
594
+ // Check for saved language preference on page load
595
+ document.addEventListener('DOMContentLoaded', function() {
596
+ const preferredLanguage = localStorage.getItem('preferredLanguage');
597
+ if (preferredLanguage) {
598
+ // In a real app, you would load the appropriate language here
599
+ console.log(`Preferred language: ${preferredLanguage}`);
600
+ }
601
+ });
602
  </script>
603
 
604
  <!-- Mobile Menu Toggle Script -->