-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsuper.js
75 lines (56 loc) · 2.18 KB
/
super.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
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
71
72
73
74
const hamburgerToggle_div = document.getElementById('hamburgerToggle');
const navList_Div = document.getElementById('navList')
const closeMenu_B = document.getElementById('closeMenu');
const galleryItem_Div = document.getElementById('galleryItem');
const galleryItemContainer_Div = document.getElementById('galleryItemContainer');
closeMenu_B.addEventListener('click', () => {
navList_Div.classList.toggle('show');
});
hamburgerToggle_div.addEventListener('click', () => {
navList_Div.classList.toggle('show');
});
document.addEventListener('DOMContentLoaded', function () {
const glide = new Glide('.glide', {
type: 'carousel',
startAt: 0,
perView: 2.3,
focusAt: '0',
gap: 20,
peek: {
before: 40,
after: 0
},
breakpoints: {
1024: {
perView: 2
},
768: {
perView: 1.5
},
480: {
perView: 1
}
}
});
glide.mount();
// Function to update the background, button color, header, and description
function updateSlideContent() {
const currentSlide = document.querySelector('.glide__slide--active');
if (currentSlide) {
const backgroundImage = currentSlide.getAttribute('data-bg');
const buttonColor = currentSlide.getAttribute('data-button-color');
const headerText = currentSlide.getAttribute('data-header');
const descriptionText = currentSlide.getAttribute('data-description');
document.querySelector('.body').style.backgroundImage = `linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.904)), ${backgroundImage}`;
document.getElementById('exploreButton').style.backgroundColor = buttonColor;
document.getElementById('headerText').innerText = headerText;
document.getElementById('descriptionText').innerText = descriptionText;
}
}
// Update content when the glide index changes
glide.on('run.after', function () {
updateSlideContent();
});
// Initial activation of the first slide
updateSlideContent();
});