File size: 2,276 Bytes
78f0a1f
ddc5069
 
 
78f0a1f
ddc5069
 
 
 
 
 
78f0a1f
ddc5069
78f0a1f
ddc5069
 
 
 
 
 
 
78f0a1f
 
 
 
 
 
ddc5069
 
 
78f0a1f
ddc5069
 
78f0a1f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70

// Toggle mobile menu
function toggleMenu() {
    const menu = document.getElementById('mobile-menu');
    menu?.classList.toggle('hidden');
}

// Sticky header on scroll
window.addEventListener('scroll', function() {
    const header = document.querySelector('header');
    if (window.scrollY > 50) {
        header?.classList.add('bg-gray-900', 'shadow-lg');
    } else {
        header?.classList.remove('bg-gray-900', 'shadow-lg');
    }
});

// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
    anchor.addEventListener('click', function(e) {
        e.preventDefault();
        const target = document.querySelector(this.getAttribute('href'));
        if (target) {
            target.scrollIntoView({
                behavior: 'smooth'
            });
        }
    });
});

// Dynamic movie cards hover effects
document.addEventListener('DOMContentLoaded', function() {
    feather.replace();
    
    // Add click handlers for movie cards
    document.querySelectorAll('.group.cursor-pointer').forEach(card => {
        card.addEventListener('click', function() {
            // Simulate navigation to movie details
            window.location.href = 'movie-details.html';
        });
    });

    // Load more functionality
    const loadMoreBtn = document.querySelector('button:contains("Load More")');
    if (loadMoreBtn) {
        loadMoreBtn.addEventListener('click', function() {
            this.innerHTML = '<i data-feather="loader" class="w-5 h-5 mr-2 animate-spin"></i> Loading...';
            setTimeout(() => {
                this.innerHTML = 'Load More Movies';
                feather.replace();
            }, 2000);
        });
    }
});

// Filter functionality for movies page
document.addEventListener('DOMContentLoaded', function() {
    const filterButtons = document.querySelectorAll('select');
    filterButtons.forEach(select => {
        select.addEventListener('change', function() {
            // Simulate filtering movies
            const cards = document.querySelectorAll('.group.cursor-pointer');
            cards.forEach(card => {
                card.style.opacity = '0.5';
                setTimeout(() => card.style.opacity = '1', 300);
            });
        });
    });
});