File size: 1,556 Bytes
1b66eef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Initialize tooltips
document.addEventListener('DOMContentLoaded', function() {
    // Any initialization code can go here
    console.log('CryptoSwap Galaxy Explorer loaded');
    
    // Smooth scroll for anchor links
    document.querySelectorAll('a[href^="#"]').forEach(anchor => {
        anchor.addEventListener('click', function (e) {
            e.preventDefault();
            document.querySelector(this.getAttribute('href')).scrollIntoView({
                behavior: 'smooth'
            });
        });
    });
});

// Exchange rate ticker simulation
function updateTicker() {
    const coins = ['BTC', 'ETH', 'SOL', 'XRP', 'ADA'];
    const ticker = document.getElementById('exchange-ticker');
    
    if (ticker) {
        let tickerContent = '';
        coins.forEach(coin => {
            const price = (Math.random() * 10000).toFixed(2);
            const change = (Math.random() * 5 - 2.5).toFixed(2);
            const isPositive = parseFloat(change) > 0;
            
            tickerContent += `
                <div class="flex items-center px-4">
                    <span class="font-medium">${coin}</span>
                    <span class="mx-2">$${price}</span>
                    <span class="${isPositive ? 'text-green-400' : 'text-red-400'}">
                        ${isPositive ? '+' : ''}${change}%
                    </span>
                </div>
            `;
        });
        
        ticker.innerHTML = tickerContent;
    }
}

// Update ticker every 5 seconds
setInterval(updateTicker, 5000);
updateTicker();