File size: 943 Bytes
86112bd |
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 |
document.addEventListener('DOMContentLoaded', () => {
// Existing functionality: Redirect to movie details page when clicked
const movies = document.querySelectorAll('.movie');
movies.forEach(movie => {
movie.addEventListener('click', () => {
// Redirect to movie details page when clicked
const link = movie.querySelector('a');
if (link) {
window.location.href = link.href;
}
});
});
});
// Get all elements with the class "option"
const options = document.querySelectorAll('.option');
// Attach a click event listener to each option element
options.forEach(option => {
option.addEventListener('click', function() {
// Remove the "active" class from all option elements
options.forEach(el => el.classList.remove('active'));
// Add the "active" class to the clicked option element
this.classList.add('active');
});
});
|