-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
150 lines (138 loc) · 5.91 KB
/
index.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
const artistes = [
{
name: 'Pause Flow',
style: 'Rap',
about: 'Lorem ipsum dolor sit amet consectetur, adipisicing elit. Dolor eaque earum rem consequuntur blanditiis',
picture: 'img/singers/pause.jpg',
},
{
name: 'Don Big',
style: 'Rap',
about: 'Lorem ipsum dolor sit amet consectetur, adipisicing elit. Dolor eaque earum rem consequuntur blanditiis',
picture: 'img/singers/don_big.jpg',
},
{
name: 'Amine Kamal',
style: 'Fusion',
about: 'Lorem ipsum dolor sit amet consectetur, adipisicing elit. Dolor eaque earum rem consequuntur blanditiis',
picture: 'img/singers/amin_kamal.jpg',
},
{
name: 'Betwinatna',
style: 'Rock',
about: 'Lorem ipsum dolor sit amet consectetur, adipisicing elit. Dolor eaque earum rem consequuntur blanditiis',
picture: 'img/singers/betwinatna.jpg',
},
{
name: 'Hoba Hoba Spirit',
style: 'Rock',
about: 'Lorem ipsum dolor sit amet consectetur, adipisicing elit. Dolor eaque earum rem consequuntur blanditiis',
picture: 'img/singers/hoba_hoba_spirit.jpg',
},
{
name: 'Oum El Ghaït Benessahraoui',
style: 'Soul/Afrobeat',
about: 'Lorem ipsum dolor sit amet consectetur, adipisicing elit. Dolor eaque earum rem consequuntur blanditiis',
picture: 'img/singers/oum.jpg',
},
];
const participantBtn = document.createElement('button');
participantBtn.classList.add('participants_btn');
participantBtn.setAttribute('type', 'button');
participantBtn.innerHTML = 'MORE <i class="fa fa-arrow-down"></i>';
participantBtn.addEventListener('click', () => {
document.querySelector('.participants_group').innerHTML = '';
for (let i = 0; i < artistes.length; i += 1) {
const participant = document.createElement('article');
const participantImg = document.createElement('div');
const imageDots = document.createElement('img');
const participantPicture = document.createElement('img');
const participantInfo = document.createElement('div');
const participantName = document.createElement('h3');
const participantStyle = document.createElement('h4');
const hr = document.createElement('hr');
const participantAbout = document.createElement('p');
participant.classList.add('participant');
participantImg.classList.add('participant_img');
imageDots.classList.add('participant_dots');
imageDots.setAttribute('src', 'img/image_dots.svg');
imageDots.setAttribute('alt', 'dots');
participantPicture.classList.add('participant_picture');
participantPicture.setAttribute('src', artistes[i].picture);
participantPicture.setAttribute('alt', 'singer_picture');
participantInfo.classList.add('participant_info');
participantName.classList.add('participant_name');
participantName.textContent = artistes[i].name;
participantStyle.classList.add('participant_style');
participantStyle.textContent = artistes[i].style;
participantAbout.classList.add('participant_about');
participantAbout.textContent = artistes[i].about;
participantImg.append(imageDots, participantPicture);
participantInfo.append(participantName, participantStyle, hr, participantAbout);
participant.append(participantImg, participantInfo);
document.querySelector('.participants_group').append(participant);
}
});
document.addEventListener('DOMContentLoaded', () => {
for (let i = 0; i < 2; i += 1) {
const participant = document.createElement('article');
const participantImg = document.createElement('div');
const imageDots = document.createElement('img');
const participantPicture = document.createElement('img');
const participantInfo = document.createElement('div');
const participantName = document.createElement('h3');
const participantStyle = document.createElement('h4');
const hr = document.createElement('hr');
const participantAbout = document.createElement('p');
participant.classList.add('participant');
participantImg.classList.add('participant_img');
imageDots.classList.add('participant_dots');
imageDots.setAttribute('src', 'img/image_dots.svg');
imageDots.setAttribute('alt', 'dots');
participantPicture.classList.add('participant_picture');
participantPicture.setAttribute('src', artistes[i].picture);
participantPicture.setAttribute('alt', 'singer_picture');
participantInfo.classList.add('participant_info');
participantName.classList.add('participant_name');
participantName.textContent = artistes[i].name;
participantStyle.classList.add('participant_style');
participantStyle.textContent = artistes[i].style;
participantAbout.classList.add('participant_about');
participantAbout.textContent = artistes[i].about;
participantImg.append(imageDots, participantPicture);
participantInfo.append(participantName, participantStyle, hr, participantAbout);
participant.append(participantImg, participantInfo);
document.querySelector('.participants_group').append(participant);
}
document.querySelector('.participants_group').append(participantBtn);
});
// mobile menu
const menuButton = document.querySelector('.menu_btn');
const mobileMenu = document.querySelector('.nav_menu_mobile');
const remButton = document.querySelector('.fa-times');
// transition styles
mobileMenu.style.left = '-800px';
mobileMenu.style.transition = 'left 800ms';
// listen for a click on the menu button and X button
menuButton.addEventListener('click', () => {
mobileMenu.style.display = 'flex';
setTimeout(() => {
mobileMenu.style.left = '0px';
}, 1);
});
remButton.addEventListener('click', () => {
mobileMenu.style.left = '-800px';
setTimeout(() => {
mobileMenu.style.display = 'none';
}, 900);
menuButton.style.display = 'block';
});
document.querySelectorAll('.nav_link_mobile').forEach((link) => {
link.addEventListener('click', () => {
mobileMenu.style.left = '-800px';
setTimeout(() => {
mobileMenu.style.display = 'none';
}, 900);
menuButton.style.display = 'block';
});
});