// Search Autocomplete Functionality document.addEventListener('DOMContentLoaded', function() { const searchInput = document.getElementById('searchInput'); const searchDropdown = document.getElementById('searchDropdown'); const finderPills = document.querySelector('.finder__pills'); if (!searchInput || !searchDropdown || !finderPills) return; // Get all links from finder__pills const allLinks = Array.from(finderPills.querySelectorAll('a')); // Search functionality function updateDropdown(query) { // Clear previous results searchDropdown.innerHTML = ''; if (!query || query.trim() === '') { searchDropdown.style.display = 'none'; return; } // Filter matching items const matches = allLinks.filter(link => { const text = link.textContent.toLowerCase(); const searchQuery = query.toLowerCase(); return text.includes(searchQuery); }); if (matches.length === 0) { searchDropdown.style.display = 'none'; return; } // Add matching items to dropdown matches.forEach(link => { const clonedLink = link.cloneNode(true); clonedLink.style.cssText = 'display: block; padding: 0.75rem 1rem; color: #1f2937; text-decoration: none; transition: background-color 0.15s;'; clonedLink.onmouseover = function() { this.style.backgroundColor = '#f3f4f6'; }; clonedLink.onmouseout = function() { this.style.backgroundColor = ''; }; searchDropdown.appendChild(clonedLink); }); searchDropdown.style.display = 'block'; } // Event listeners searchInput.addEventListener('input', function(e) { updateDropdown(e.target.value); }); // Close dropdown when clicking outside document.addEventListener('click', function(e) { if (!searchDropdown.contains(e.target) && e.target !== searchInput) { searchDropdown.style.display = 'none'; } }); // Handle arrow key navigation searchInput.addEventListener('keydown', function(e) { const items = searchDropdown.querySelectorAll('a'); let currentIndex = -1; // Find current selected item items.forEach((item, index) => { if (item.style.backgroundColor === 'rgb(243, 244, 246)' || item.style .backgroundColor === '#f3f4f6') { currentIndex = index; } }); if (e.key === 'ArrowDown') { e.preventDefault(); currentIndex = Math.min(currentIndex + 1, items.length - 1); updateSelection(items, currentIndex); } else if (e.key === 'ArrowUp') { e.preventDefault(); currentIndex = Math.max(currentIndex - 1, 0); updateSelection(items, currentIndex); } else if (e.key === 'Enter' && currentIndex >= 0) { e.preventDefault(); items[currentIndex].click(); } }); function updateSelection(items, index) { items.forEach((item, i) => { if (i === index) { item.style.backgroundColor = '#f3f4f6'; } else { item.style.backgroundColor = ''; } }); } });
215 951 360 so‘mdan
Batafsil284 900 000 so‘mdan
Batafsil657 730 560 so‘mdan
Batafsil795 000 000 so‘mdan
Batafsil1 109 274 880 so‘m
Batafsil
1 464 500 000 so‘m
Batafsil1 485 100 000 so‘m
Batafsil
Chegirma 15 000 000 so‘m
Ushbu chegirma avtomobilni 100% to'lov bilan sotib olganda qo'llaniladi*
Chegirma 22 000 000 so‘m
Ushbu chegirma avtomobilni 100% to'lov bilan sotib olganda qo'llaniladi*
Chegirma 15 000 000 so‘m
Ushbu chegirma avtomobilni 100% to'lov bilan sotib olganda qo'llaniladi*