-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
118 lines (108 loc) · 4.39 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
// Popup Nav
function openPopUp() {
document.querySelector('.popup-nav').classList.add('popup-nav-visible');
}
function closePopUp() {
document.querySelector('.popup-nav').classList.replace('popup-nav-visible', 'popup-nav');
}
document.querySelector('.menu').addEventListener('click', openPopUp);
document.querySelector('.cancel-button').addEventListener('click', closePopUp);
document.querySelector('.popup-menu .menu-item').addEventListener('click', closePopUp);
document.querySelector('.popup-menu .menu-item2').addEventListener('click', closePopUp);
document.querySelector('.popup-menu .menu-item3').addEventListener('click', closePopUp);
document.querySelector('.popup-nav').addEventListener('click', closePopUp);
// Featured Speakers
const speakersData = [
{
id: 1,
name: 'John Smith',
FeaturedImage: 'images/speaker_1.svg',
Description: 'Experienced educator with a Bachelor\'s degree in Education',
fullDescription: 'Benkler studies commons-based peer production, and published his seminal book, The Wealth of Networks in 2006',
},
{
id: 2,
name: 'Jane Doe',
FeaturedImage: 'images/speaker_2.svg',
Description: 'Highly qualified teacher with a Master\'s degree in Educational Leadership',
fullDescription: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Odio a nostrum maiores deserunt expedita quae cum eligendi, cupiditate nesciunt voluptates voluptatum',
},
{
id: 3,
name: 'Mary Brown',
FeaturedImage: 'images/speaker_3.svg',
Description: ' Accomplished professor with a Bachelor\'s degree in Special Education',
fullDescription: 'Lorem ipsum, dolor sit amet consectetur adipisicing elit. Hic voluptates veniam quos minima. Quaerat perspiciatis, animi magni minus velit provident neque aperiam laborum.',
},
{
id: 4,
name: 'Sarah Johnson',
FeaturedImage: 'images/speaker_4.svg',
Description: '',
fullDescription: 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Minus molestiae quo officiis incidunt? Accusantium, soluta? Ex praesentium laboriosam quasi exercitationem nemo architecto',
},
{
id: 5,
name: 'David Williams',
FeaturedImage: 'images/speaker_5.svg',
Description: 'Master\'s degree in Educational Technology',
fullDescription: 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloremque rem placeat itaque omnis, vero exercitationem iusto laudantium officia nulla magni, laboriosam illo.',
},
{
id: 6,
name: 'Robert Jones',
FeaturedImage: 'images/speaker_6.svg',
Description: 'Innovative educator with a Doctorate in Educational Administration',
fullDescription: 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Earum iure quibusdam et obcaecati rem cumque, unde laudantium. Repellendus!',
},
];
const speakerContainer = document.querySelector('.profile-container');
const profiles = `<h2>
Top Donators
</h2>
<hr>
<div class="profile-cards">
${speakersData.map((speaker) => `<div id="card${speaker.id}" class="profile-card card${speaker.id}">
<img src="${speaker.FeaturedImage}" alt="speaker ${speaker.id} image">
<div class="profile-detail">
<h3>${speaker.name}</h3>
<p class="profile-summary">${speaker.Description}</p>
<hr>
<p class="profile-desc">${speaker.fullDescription}</p>
</div>
</div>`).join('\n')}
</div>
<button class="more-btn">
More
<span class="material-symbols-outlined">
expand_more
</span>
</button>
</div>`;
speakerContainer.innerHTML = profiles;
const showMoreBtn = document.querySelector('.more-btn');
let toggel = true;
const showMore = () => {
if (toggel) {
document.getElementById('card3').classList.remove('card3');
document.getElementById('card4').classList.remove('card4');
document.getElementById('card5').classList.remove('card5');
document.getElementById('card6').classList.remove('card6');
showMoreBtn.innerHTML = `Less
<span class="material-symbols-outlined">
expand_less
</span>`;
toggel = !toggel;
} else {
document.getElementById('card3').classList.add('card3');
document.getElementById('card4').classList.add('card4');
document.getElementById('card5').classList.add('card5');
document.getElementById('card6').classList.add('card6');
showMoreBtn.innerHTML = `More
<span class="material-symbols-outlined">
expand_more
</span>`;
toggel = !toggel;
}
};
showMoreBtn.addEventListener('click', showMore);