generated from microverseinc/readme-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
85 lines (79 loc) · 3.53 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
const hamIcon = document.querySelector('.hamburger');
const closeBtn = document.querySelector('.close-up');
const toggleMenu = document.querySelector('.toggle-menu');
const speakers = [{
image: 'images/tutor2.png',
name: 'Lyla Treticov',
position: 'Secretary General of the Wikimedia Foundation',
bio: 'Layla Treticov is the Executive Director of the Wikimedia Foundation, the non-profit organization that runs Wikipedia. Wikipedia is provided free of charge in 290 languages each month to over 100 million people, nearly half of the world population.',
},
{
image: 'images/tutor3.png',
name: 'Lyla Treticov',
position: 'Secretary General of the Wikimedia Foundation',
bio: 'Layla Treticov is the Executive Director of the Wikimedia Foundation, the non-profit organization that runs Wikipedia. Wikipedia is provided free of charge in 290 languages each month to over 100 million people, nearly half of the world population.',
},
{
image: 'images/tutor6.png',
name: 'Lyla Treticov',
position: 'Secretary General of the Wikimedia Foundation',
bio: 'Layla Treticov is the Executive Director of the Wikimedia Foundation, the non-profit organization that runs Wikipedia. Wikipedia is provided free of charge in 290 languages each month to over 100 million people, nearly half of the world population.',
},
{
image: 'images/tutor4.png',
name: 'Lyla Treticov',
position: 'Secretary General of the Wikimedia Foundation',
bio: 'Layla Treticov is the Executive Director of the Wikimedia Foundation, the non-profit organization that runs Wikipedia. Wikipedia is provided free of charge in 290 languages each month to over 100 million people, nearly half of the world population.',
},
{
image: 'images/tutor5.png',
name: 'Lyla Treticov',
position: 'Secretary General of the Wikimedia Foundation',
bio: 'Layla Treticov is the Executive Director of the Wikimedia Foundation, the non-profit organization that runs Wikipedia. Wikipedia is provided free of charge in 290 languages each month to over 100 million people, nearly half of the world population.',
},
{
image: 'images/tuttor1.png',
name: 'Lyla Treticov',
position: 'Secretary General of the Wikimedia Foundation',
bio: 'Layla Treticov is the Executive Director of the Wikimedia Foundation, the non-profit organization that runs Wikipedia. Wikipedia is provided free of charge in 290 languages each month to over 100 million people, nearly half of the world population.',
},
];
function createSpeakerHTML(speaker) {
return `
<article class="speaker-info automated">
<div class="speaker-img">
<img class="thumbnail1_1" src="${speaker.image}" alt="image of speaker">
</div>
<div class="bio-container">
<div>
<h4 class="speaker-tag">${speaker.name}</h4>
<p class="speaker-title">${speaker.position}</p>
</div>
<br>
<div class="speaker-bio">
<p class="name">${speaker.bio}</p>
</div>
</div>
</article>
`;
}
const tutor = document.querySelector('.speaker-container');
function addSpeakers(count) {
tutor.innerHTML += speakers
.slice(0, count)
.map(createSpeakerHTML)
.join('');
}
if (window.matchMedia('(max-width: 767px)').matches) {
hamIcon.addEventListener('click', () => {
toggleMenu.style.display = 'block';
hamIcon.style.visibility = 'hidden';
});
closeBtn.addEventListener('click', () => {
toggleMenu.style.display = 'none';
hamIcon.style.visibility = 'visible';
});
addSpeakers(2);
} else {
addSpeakers(speakers.length);
}