-
Notifications
You must be signed in to change notification settings - Fork 0
/
bloggin.html
57 lines (53 loc) · 1.71 KB
/
bloggin.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Wave's Blog!</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<div class="logo">
<img src="blogging/waves-blog.png" alt="Logo" id="Logo">
</div>
<nav>
<ul>
<li><a href="bloggin.html">Main blog page</a></li>
</ul>
</nav>
</header>
<div class="content">
<main>
<h1>Welcome to My Blog</h1>
<p>Hey all! Gonna be bloggin here.</p>
</main>
<aside>
<button id="toggleBtn">Show/hide posts</button>
<div class="panel">
<ul id="link-list">
</ul>
</div>
</aside>
</div>
<script src="blogging/currentArticles.js"></script>
<script>
const toggleBtn = document.getElementById('toggleBtn');
const panel = document.querySelector('.panel');
const listOfLinks = document.getElementById('link-list');
currentArticles.forEach((article) => {
var a = document.createElement("a");
var link = document.createTextNode(article.name);
a.appendChild(link);
a.href = article.link;
var li = document.createElement("li");
li.appendChild(a);
listOfLinks.appendChild(li);
});
toggleBtn.addEventListener('click', () => {
if (panel.style.display == 'none') {panel.style.display = "inline";} else {panel.style.display = "none"}
});
</script>
</body>
</html>