-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
114 lines (96 loc) · 3.74 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
import { speakers, seeMoreSpeakers, fullSpeakerList } from './speakers.js';
const cardsContainer = document.querySelector('.cards-container');
const main = document.querySelector('main');
const hamburger = document.querySelector('[data-menu]');
function guestSpeakersDesktop(arr) {
for (let i = 0; i < arr.length; i += 1) {
const speakerDetails = arr[i];
const card = document.createElement('div');
card.className = 'cards';
card.classList.add('desktop-cards');
card.innerHTML = `<div class="image-container">
<img class="speaker-image" src=${speakerDetails.image.src} alt="Speaker's Image"/>
</div>
<div class="speaker-details">
<h3 class="sub-section-header-black">${speakerDetails.name}</h3>
<p class="sub-section-text-black red-color">${speakerDetails.honours}</p>
<div class="middle-underline flex">
<div class="line-grey"></div>
</div>
<p class="sub-section-text-black">${speakerDetails.books}</p>
</div>`;
cardsContainer.appendChild(card);
}
return cardsContainer;
}
guestSpeakersDesktop(fullSpeakerList);
const menu = () => {
const modal = document.createElement('section');
modal.className = 'menu';
modal.innerHTML = `<ul class="menu-list">
<div class="close flex">
<p>X</p>
</div>
<li><a class='hyperlink' href="index.html">Home <div class="">
<div class="line"></div>
</div></a></li>
<li><a class='hyperlink' href="about.html">About <div class="middle-underline flex justify-center">
<div class="line"></div>
</div></a></li>
<li><a class='hyperlink' href="index.html#program-section">Program <div class="middle-underline flex justify-center">
<div class="line"></div>
</div></a></li>
<li><a class='hyperlink' href="index.html#speakers-section">Speakers <div class="middle-underline flex justify-center">
<div class="line"></div>
</div></a></li>
<li><a class='hyperlink' href="about.html#partners">Sponsors <div class="middle-underline flex justify-center">
<div class="line"></div>
</div></a></li>
</ul>`;
main.appendChild(modal);
const hyperlinks = document.querySelectorAll('.hyperlink');
const menuList = document.querySelector('.menu-list');
hyperlinks.forEach((link) => {
link.addEventListener('click', () => {
menuList.parentNode.remove();
});
});
const close = document.querySelector('.close');
close.addEventListener('click', () => {
menuList.parentNode.remove();
});
};
hamburger.addEventListener('click', menu);
const guestSpeakers = (arr) => {
for (let i = 0; i < arr.length; i += 1) {
const speakerDetails = arr[i];
const card = document.createElement('div');
card.className = 'cards';
card.classList.add('mobile-cards');
card.innerHTML = `<div class="image-container">
<img class="speaker-image" src=${speakerDetails.image.src} alt="Speaker's Image"/>
</div>
<div class="speaker-details">
<h3 class="sub-section-header-black">${speakerDetails.name}</h3>
<p class="sub-section-text-black red-color"><i>${speakerDetails.honours}</i></p>
<div class="middle-underline flex">
<div class="line-grey"></div>
</div>
<p class="sub-section-text-black">${speakerDetails.books}</p>
</div>`;
cardsContainer.appendChild(card);
}
return cardsContainer;
};
guestSpeakers(speakers);
const seeMore = document.createElement('div');
seeMore.innerHTML = `<div class="see-more flex justify-center">
<div>MORE <i class="fa fa-angle-down"></i></div>
</div>`;
const speakerSection = document.querySelector('#speakers-section');
speakerSection.appendChild(seeMore);
const seeMoreBtn = document.querySelector('.see-more');
seeMoreBtn.addEventListener('click', () => {
guestSpeakers(seeMoreSpeakers);
seeMore.remove();
});