-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
42 lines (36 loc) · 1.64 KB
/
main.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
(function() {
"use strict";
window.addEventListener("load", init);
function init() {
getElement("industry").addEventListener("click", showIndustry);
getElement("research").addEventListener("click", showResearch);
getElement("teaching").addEventListener("click", showTeaching);
}
function showIndustry() {
getElement("industry-description").classList.remove("hidden");
getElement("industry").classList.add("selected");
getElement("research-description").classList.add("hidden");
getElement("teaching-description").classList.add("hidden");
getElement("research").classList.remove("selected");
getElement("teaching").classList.remove("selected");
}
function showResearch() {
getElement("research-description").classList.remove("hidden");
getElement("research").classList.add("selected");
getElement("industry-description").classList.add("hidden");
getElement("teaching-description").classList.add("hidden");
getElement("industry").classList.remove("selected");
getElement("teaching").classList.remove("selected");
}
function showTeaching() {
getElement("teaching-description").classList.remove("hidden");
getElement("teaching").classList.add("selected");
getElement("research-description").classList.add("hidden");
getElement("industry-description").classList.add("hidden");
getElement("research").classList.remove("selected");
getElement("industry").classList.remove("selected");
}
function getElement(id) {
return document.getElementById(id);
}
})();