-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.js
41 lines (37 loc) · 1.23 KB
/
scripts.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
const body = document.querySelector('body');
const brandLinks = document.getElementById('brand-links');
const mainLinks = document.getElementById('main-links');
const pageContent = document.getElementById('page-content');
brandLinks.addEventListener("click", (event) => {
if (body.classList.contains("bkg-western")) {
body.classList.toggle("bkg-western");
body.classList.toggle("bkg-tribune");
}
content = "<home-page></home-page>";
pageContent.innerHTML = content;
})
mainLinks.addEventListener("click", (event) => {
if (body.classList.contains("bkg-tribune")) {
body.classList.toggle("bkg-tribune");
body.classList.toggle("bkg-western");
}
let selectedLink = event.target.id;
displayPageContent(selectedLink);
})
function displayPageContent(selectedLink) {
let content;
switch (selectedLink) {
case "projects-link":
content = "<projects-page></projects-page>";
break;
case "articles-link":
content = "<articles-page></articles-page>";
break;
case "about-link":
content = "<about-page></about-page>";
break;
default:
return;
}
pageContent.innerHTML = content;
}