|
|
| |
| function toggleMenu() { |
| const menu = document.getElementById('mobile-menu'); |
| menu?.classList.toggle('hidden'); |
| } |
|
|
| |
| 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'); |
| } |
| }); |
|
|
| |
| 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' |
| }); |
| } |
| }); |
| }); |
|
|
| |
| document.addEventListener('DOMContentLoaded', function() { |
| feather.replace(); |
| |
| |
| document.querySelectorAll('.group.cursor-pointer').forEach(card => { |
| card.addEventListener('click', function() { |
| |
| window.location.href = 'movie-details.html'; |
| }); |
| }); |
|
|
| |
| 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); |
| }); |
| } |
| }); |
|
|
| |
| document.addEventListener('DOMContentLoaded', function() { |
| const filterButtons = document.querySelectorAll('select'); |
| filterButtons.forEach(select => { |
| select.addEventListener('change', function() { |
| |
| const cards = document.querySelectorAll('.group.cursor-pointer'); |
| cards.forEach(card => { |
| card.style.opacity = '0.5'; |
| setTimeout(() => card.style.opacity = '1', 300); |
| }); |
| }); |
| }); |
| }); |
|
|