-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
109 lines (100 loc) · 3.75 KB
/
script.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
// Hamburger menu animation
const hamburger = document.querySelector('.hamburger');
const navMenu = document.querySelector('.menu');
hamburger.addEventListener('click', () => {
hamburger.classList.toggle('active');
navMenu.classList.toggle('active');
});
document.querySelectorAll('.list1').forEach((n) => n.addEventListener('click', () => {
hamburger.classList.remove('active');
navMenu.classList.remove('active');
}));
// Create speaker section dynamically
const speaker = [
{
imagen: './images/speakers/james-preston.jpg',
alt: 'Speaker James Preston',
speakerName: 'James Preston',
workSpeaker: 'Globalcryto.tv Co-founder and comms manager at Zeitgeist',
bioSpeaker: 'James is an accomplished tech writer and speaker and currently server.',
},
{
imagen: './images/speakers/justin-Sun.jpg',
alt: 'Speaker Justin Sun',
speakerName: 'Justin Sun',
workSpeaker: 'Founder of Tron',
bioSpeaker: 'Justin Sun is the Founder of TRON, one of the world’s largest.',
},
{
imagen: './images/speakers/sandeep-nailwal.jpg',
alt: 'Speaker Sandeep Nailwal',
speakerName: 'Sandeep Nailwal',
workSpeaker: 'Co-founder and Chief Operations Officer at Polygon',
bioSpeaker: 'Sandeep Nailwal is the Co-Founder and COO of Polygon.',
},
{
imagen: './images/speakers/raoul-pal.jpg',
alt: 'Speaker Raoul Pal',
speakerName: 'Raoul Pal',
workSpeaker: 'CEO and Co-founder of Real Vision',
bioSpeaker: 'Former hedge fund manager who retired at 36.',
},
{
imagen: './images/speakers/michael-wu.jpg',
alt: 'Speaker Michael Wu',
speakerName: 'Michael Wu',
workSpeaker: 'Co-founder and CEO of Amber Group',
bioSpeaker: 'Michael Wu is Co-founder and CEO of Amber Group, a leading global company of trading.',
},
{
imagen: './images/speakers/maarja-part.jpg',
alt: 'Speaker Maarja Part',
speakerName: 'Maarja Part',
workSpeaker: 'Ceo of Yolo Group',
bioSpeaker: 'Maarja Pärt is CEO of Yolo Group (formerly the Coingaming Group).',
},
];
for (let i = 0; i < speaker.length; i += 1) {
const cardSpeaker = document.createElement('div');
cardSpeaker.classList.add('card-speaker', `card-speaker-${i}`);
const photo = document.createElement('div');
photo.classList.add('photo');
const imag = document.createElement('img');
imag.classList.add('photo-speaker');
imag.src = speaker[i].imagen;
imag.alt = speaker[i].alt;
const desSpeaker = document.createElement('div');
desSpeaker.classList.add('des-speaker');
const speakerName = document.createElement('h4');
speakerName.classList.add('name-speaker');
speakerName.textContent = speaker[i].speakerName;
const workSpeaker = document.createElement('p');
workSpeaker.classList.add('work-speaker');
workSpeaker.textContent = speaker[i].workSpeaker;
const bioSpeaker = document.createElement('p');
bioSpeaker.classList.add('bio-speaker');
bioSpeaker.textContent = speaker[i].bioSpeaker;
const cardContainer = document.querySelector('.card-speaker-container');
cardContainer.appendChild(cardSpeaker);
cardSpeaker.appendChild(photo);
photo.appendChild(imag);
// cardContainer.appendChild(imag);
cardSpeaker.appendChild(desSpeaker);
desSpeaker.appendChild(speakerName);
desSpeaker.appendChild(workSpeaker);
desSpeaker.appendChild(bioSpeaker);
}
// Show more button
const showMore = document.querySelector('.show-more');
showMore.addEventListener('click', () => {
for (let i = 2; i < speaker.length; i += 1) {
const cardSpeaker = document.querySelector(`.card-speaker-${i}`);
if (cardSpeaker.classList.contains('active')) {
cardSpeaker.classList.remove('active');
showMore.textContent = 'MORE';
} else {
cardSpeaker.classList.add('active');
showMore.textContent = 'LESS';
}
}
});