Fazbeeer commited on
Commit
0fde75f
·
verified ·
1 Parent(s): 2c0105d

the pop up for the currency exhange and the language translator dont pop up make it fit remove items if needed

Browse files
Files changed (1) hide show
  1. index.html +32 -33
index.html CHANGED
@@ -85,28 +85,26 @@
85
  </a>
86
  </div>
87
  <div class="flex items-center space-x-4">
88
- <div class="relative group">
89
  <button id="language-btn" class="flex items-center space-x-1 bg-black bg-opacity-50 px-3 py-2 rounded-lg border border-yellow-500">
90
  <i data-feather="globe" class="text-yellow-500"></i>
91
  <span class="text-white">EN</span>
92
  </button>
93
- <div id="language-dropdown" class="absolute right-0 mt-2 w-48 bg-black border border-yellow-500 rounded-lg shadow-lg py-1 z-20 hidden">
94
- <a href="#" class="block px-4 py-2 text-white hover:bg-yellow-500 hover:text-black" data-lang="en">English</a>
95
- <a href="#" class="block px-4 py-2 text-white hover:bg-yellow-500 hover:text-black" data-lang="es">Español</a>
96
- <a href="#" class="block px-4 py-2 text-white hover:bg-yellow-500 hover:text-black" data-lang="fr">Français</a>
97
- <a href="#" class="block px-4 py-2 text-white hover:bg-yellow-500 hover:text-black" data-lang="de">Deutsch</a>
98
  </div>
99
  </div>
100
- <div class="relative group ml-2">
101
  <button id="currency-btn" class="flex items-center space-x-1 bg-black bg-opacity-50 px-3 py-2 rounded-lg border border-blue-500">
102
  <i data-feather="dollar-sign" class="text-blue-500"></i>
103
  <span class="text-white">USD</span>
104
  </button>
105
- <div id="currency-dropdown" class="absolute right-0 mt-2 w-48 bg-black border border-blue-500 rounded-lg shadow-lg py-1 z-20 hidden">
106
- <a href="#" class="block px-4 py-2 text-white hover:bg-blue-500 hover:text-black" data-currency="USD">USD ($)</a>
107
- <a href="#" class="block px-4 py-2 text-white hover:bg-blue-500 hover:text-black" data-currency="EUR">EUR (€)</a>
108
- <a href="#" class="block px-4 py-2 text-white hover:bg-blue-500 hover:text-black" data-currency="GBP">GBP (£)</a>
109
- <a href="#" class="block px-4 py-2 text-white hover:bg-blue-500 hover:text-black" data-currency="JPY">JPY (¥)</a>
110
  </div>
111
  </div>
112
 
@@ -516,45 +514,46 @@
516
  </footer>
517
 
518
  <script>
519
- // Dropdown Toggle Logic
520
- document.getElementById('language-btn').addEventListener('click', function(e) {
 
 
 
 
 
521
  e.stopPropagation();
522
- const dropdown = document.getElementById('language-dropdown');
523
- const currencyDropdown = document.getElementById('currency-dropdown');
524
- dropdown.classList.toggle('hidden');
525
  currencyDropdown.classList.add('hidden');
526
  });
527
 
528
- document.getElementById('currency-btn').addEventListener('click', function(e) {
529
  e.stopPropagation();
530
- const dropdown = document.getElementById('currency-dropdown');
531
- const languageDropdown = document.getElementById('language-dropdown');
532
- dropdown.classList.toggle('hidden');
533
  languageDropdown.classList.add('hidden');
534
  });
535
 
536
  // Close dropdowns when clicking outside
537
- document.addEventListener('click', function() {
538
- document.getElementById('language-dropdown').classList.add('hidden');
539
- document.getElementById('currency-dropdown').classList.add('hidden');
540
  });
541
 
542
- // Language and currency change handlers
543
  document.querySelectorAll('#language-dropdown a').forEach(item => {
544
- item.addEventListener('click', function(e) {
545
  e.preventDefault();
546
- const lang = this.getAttribute('data-lang');
547
- document.getElementById('language-btn').querySelector('span').textContent = lang.toUpperCase();
548
- // Here you would add actual language change logic
549
  });
550
  });
551
 
552
  document.querySelectorAll('#currency-dropdown a').forEach(item => {
553
- item.addEventListener('click', function(e) {
554
  e.preventDefault();
555
- const currency = this.getAttribute('data-currency');
556
- document.getElementById('currency-btn').querySelector('span').textContent = currency;
557
- // Here you would add actual currency conversion logic
558
  });
559
  });
560
 
 
85
  </a>
86
  </div>
87
  <div class="flex items-center space-x-4">
88
+ <div class="relative">
89
  <button id="language-btn" class="flex items-center space-x-1 bg-black bg-opacity-50 px-3 py-2 rounded-lg border border-yellow-500">
90
  <i data-feather="globe" class="text-yellow-500"></i>
91
  <span class="text-white">EN</span>
92
  </button>
93
+ <div id="language-dropdown" class="absolute right-0 mt-2 w-36 bg-black border border-yellow-500 rounded-lg shadow-lg py-1 z-20 hidden">
94
+ <a href="#" class="block px-3 py-1 text-sm text-white hover:bg-yellow-500 hover:text-black" data-lang="en">English</a>
95
+ <a href="#" class="block px-3 py-1 text-sm text-white hover:bg-yellow-500 hover:text-black" data-lang="es">Español</a>
96
+ <a href="#" class="block px-3 py-1 text-sm text-white hover:bg-yellow-500 hover:text-black" data-lang="fr">Français</a>
 
97
  </div>
98
  </div>
99
+ <div class="relative ml-2">
100
  <button id="currency-btn" class="flex items-center space-x-1 bg-black bg-opacity-50 px-3 py-2 rounded-lg border border-blue-500">
101
  <i data-feather="dollar-sign" class="text-blue-500"></i>
102
  <span class="text-white">USD</span>
103
  </button>
104
+ <div id="currency-dropdown" class="absolute right-0 mt-2 w-36 bg-black border border-blue-500 rounded-lg shadow-lg py-1 z-20 hidden">
105
+ <a href="#" class="block px-3 py-1 text-sm text-white hover:bg-blue-500 hover:text-black" data-currency="USD">USD ($)</a>
106
+ <a href="#" class="block px-3 py-1 text-sm text-white hover:bg-blue-500 hover:text-black" data-currency="EUR">EUR (€)</a>
107
+ <a href="#" class="block px-3 py-1 text-sm text-white hover:bg-blue-500 hover:text-black" data-currency="GBP">GBP (£)</a>
 
108
  </div>
109
  </div>
110
 
 
514
  </footer>
515
 
516
  <script>
517
+ // Simplified Dropdown Toggle Logic
518
+ const languageBtn = document.getElementById('language-btn');
519
+ const currencyBtn = document.getElementById('currency-btn');
520
+ const languageDropdown = document.getElementById('language-dropdown');
521
+ const currencyDropdown = document.getElementById('currency-dropdown');
522
+
523
+ languageBtn.addEventListener('click', (e) => {
524
  e.stopPropagation();
525
+ languageDropdown.classList.toggle('hidden');
 
 
526
  currencyDropdown.classList.add('hidden');
527
  });
528
 
529
+ currencyBtn.addEventListener('click', (e) => {
530
  e.stopPropagation();
531
+ currencyDropdown.classList.toggle('hidden');
 
 
532
  languageDropdown.classList.add('hidden');
533
  });
534
 
535
  // Close dropdowns when clicking outside
536
+ document.addEventListener('click', () => {
537
+ languageDropdown.classList.add('hidden');
538
+ currencyDropdown.classList.add('hidden');
539
  });
540
 
541
+ // Handle selections
542
  document.querySelectorAll('#language-dropdown a').forEach(item => {
543
+ item.addEventListener('click', (e) => {
544
  e.preventDefault();
545
+ document.querySelector('#language-btn span').textContent =
546
+ item.getAttribute('data-lang').toUpperCase();
547
+ languageDropdown.classList.add('hidden');
548
  });
549
  });
550
 
551
  document.querySelectorAll('#currency-dropdown a').forEach(item => {
552
+ item.addEventListener('click', (e) => {
553
  e.preventDefault();
554
+ document.querySelector('#currency-btn span').textContent =
555
+ item.getAttribute('data-currency');
556
+ currencyDropdown.classList.add('hidden');
557
  });
558
  });
559