Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ // Mobile menu toggle
+ const menuToggle = document.querySelector('.menu-toggle');
+ const navLinks = document.querySelector('.nav-links');
+
+ menuToggle.addEventListener('click', () => {
+ navLinks.classList.toggle('active');
+ });
+
+ // Simulated market data
+ const marketData = {
+ sp500: { value: 4185.82, change: 1.23 },
+ nasdaq: { value: 12668.16, change: -0.76 },
+ dow: { value: 33875.40, change: 0.54 }
+ };
+
+ // Update market cards
+ function updateMarketCards() {
+ Object.entries(marketData).forEach(([index, data]) => {
+ const card = document.getElementById(index);
+ const valueDiv = card.querySelector('.value');
+ const changeDiv = card.querySelector('.change');
+
+ valueDiv.textContent = data.value.toLocaleString();
+ changeDiv.textContent = `${data.change > 0 ? '+' : ''}${data.change}%`;
+ changeDiv.style.color = data.change > 0 ? 'var(--success-color)' : 'var(--danger-color)';
+ });
+ }
+
+ // Simulated stock recommendations
+ const recommendations = [
+ { symbol: 'AAPL', action: 'Buy', price: 150.25, potential: '+12%' },
+ { symbol: 'MSFT', action: 'Hold', price: 285.30, potential: '+8%' },
+ { symbol: 'GOOGL', action: 'Buy', price: 2750.15, potential: '+15%' },
+ ];
+
+ // Display recommendations
+ function displayRecommendations() {
+ const container = document.getElementById('recommendationsContainer');
+
+ recommendations.forEach(stock => {
+ const card = document.createElement('div');
+ card.className = 'market-card';
+ card.innerHTML = `
+
${stock.symbol}
+
Action: ${stock.action}
+
Current Price: $${stock.price}
+
Potential: ${stock.potential}
+ `;
+ container.appendChild(card);
+ });
+ }
+
+ // Stock search functionality
+ const searchButton = document.getElementById('searchButton');
+ const searchInput = document.getElementById('stockSearch');
+ const analysisResult = document.getElementById('analysisResult');
+
+ searchButton.addEventListener('click', () => {
+ const symbol = searchInput.value.toUpperCase();
+ if (symbol) {
+ analysisResult.innerHTML = `
+
+
Analysis for ${symbol}
+
Please wait while we analyze market conditions...
+
+ `;
+ // In a real application, this would make an API call
+ }
+ });
+
+ // Initialize the page
+ updateMarketCards();
+ displayRecommendations();
+ });