-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
27 lines (24 loc) · 1.32 KB
/
app.js
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
let changeBackgroundImage = clickedImage => {
const mainSection = document.getElementById('main-section');
const images = document.querySelectorAll('.images img');
images.forEach(image => image.parentElement.classList.remove('active-image'));
clickedImage.parentElement.classList.add('active-image');
const imageSrc = clickedImage.src;
mainSection.style.backgroundImage = `url(${imageSrc})`;
}
let changeBackgroundImageSeason = clickedImage => {
const seasonsSection = document.getElementById('seasons-section');
const images = document.querySelectorAll('.images img');
images.forEach(image => image.parentElement.classList.remove('seasons-active-image'));
clickedImage.parentElement.classList.add('seasons-active-image');
const imageSrc = clickedImage.src;
seasonsSection.style.backgroundImage = `url(${imageSrc})`;
}
let changeBackgroundImageSeries = clickedImage => {
const tvSeriesSection = document.getElementById('tv-series-section');
const images = document.querySelectorAll('.images img');
images.forEach(image => image.parentElement.classList.remove('tv-series-active-image'));
clickedImage.parentElement.classList.add('tv-series-active-image');
const imageSrc = clickedImage.src;
tvSeriesSection.style.backgroundImage = `url(${imageSrc})`;
}