-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
74 lines (63 loc) · 2.26 KB
/
index.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Slider Sidebar</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<div class="container">
<div class="navbar">
<img src="media/logo.png" alt="logo" class="logo">
<img src="media/menu-icon.png" alt="logo" class="menu-icon">
</div>
<div class="row">
<div class="left-col">
<div class="content">
<h1><span>Colors</span> are the smiles of nature</h1>
<p>In nature, light creates colors. In the picture, <br> color creates the lights.</p>
<div class="arrow">
<img src="media/arrow.png" alt="arrow">
</div>
<img src="media/art.png" alt="art" class="art">
</div>
</div>
<div class="right-col">
<img src="media/pic1.png" alt="pic1" id="picture">
</div>
</div>
<div class="controller">
<ul>
<li class="active btn">01</li>
<li class="btn">02</li>
<li class="btn">03</li>
<li class="btn">04</li>
</ul>
</div>
</div>
<script>
var btn = document.getElementsByClassName("btn");
var picture = document.getElementById("picture");
for (let i=0; i<btn.length; i++) {
btn[i].addEventListener('click', function() {
let current = document.getElementsByClassName("active");
current[0].className = current[0].className.replace("active", "");
this.className += " active";
});
}
btn[0].onclick = function(){
picture.src = "media/pic1.png";
}
btn[1].onclick = function(){
picture.src = "media/pic2.png";
}
btn[2].onclick = function(){
picture.src = "media/pic3.png";
}
btn[3].onclick = function(){
picture.src = "media/pic4.png";
}
</script>
</body>
</html>