// Main JavaScript file for shared functionality // Smooth scrolling for anchor links document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function (e) { e.preventDefault(); document.querySelector(this.getAttribute('href')).scrollIntoView({ behavior: 'smooth' }); }); }); // Mobile menu toggle functionality (will be used by navbar component) function toggleMobileMenu() { const mobileMenu = document.getElementById('mobile-menu'); mobileMenu.classList.toggle('hidden'); } // Property search functionality function initPropertySearch() { const searchInput = document.getElementById('property-search'); if (searchInput) { searchInput.addEventListener('input', function() { const searchTerm = this.value.toLowerCase(); const propertyCards = document.querySelectorAll('custom-property-card'); propertyCards.forEach(card => { const title = card.getAttribute('title').toLowerCase(); const location = card.getAttribute('location').toLowerCase(); if (title.includes(searchTerm) || location.includes(searchTerm)) { card.style.display = 'block'; } else { card.style.display = 'none'; } }); }); } } // Initialize functions when DOM is loaded document.addEventListener('DOMContentLoaded', function() { initPropertySearch(); // Initialize Feather Icons if (typeof feather !== 'undefined') { feather.replace(); } });