-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclass_activity_3.html
176 lines (161 loc) · 9.2 KB
/
class_activity_3.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
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<!-- 1- create a div box and add a text in the box. Using CSS animation keyframes, set 4 background colour to the box and 3 different border. Also use keyframes to increase the font size of the text
2- Create a div box and button and use JavaScript variables and event to make the background colour of the box change when the button is clicked -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Intro to Javascript</title>
<link rel="shortcut icon" href="img/favicon/favicon-32x32.png" type="image/x-icon" />
<link href='https://unpkg.com/[email protected]/css/boxicons.min.css' rel='stylesheet'>
<!-- <link rel="stylesheet" data-purpose="Layout StyleSheet" title="Web Awesome"
href="/css/app-wa-d53d10572a0e0d37cb8d614a3f177a0c.css?vsn=d"> -->
<link rel="stylesheet" href="https://site-assets.fontawesome.com/releases/v6.5.2/css/all.css">
<link rel="stylesheet" href="https://site-assets.fontawesome.com/releases/v6.5.2/css/sharp-thin.css">
<link rel="stylesheet" href="https://site-assets.fontawesome.com/releases/v6.5.2/css/sharp-solid.css">
<link rel="stylesheet" href="https://site-assets.fontawesome.com/releases/v6.5.2/css/sharp-regular.css">
<link rel="stylesheet" href="https://site-assets.fontawesome.com/releases/v6.5.2/css/sharp-light.css">
<link rel="stylesheet" href="style.css">
</head>
<body id="">
<aside class="side-nav">
<nav>
<span class="top-section">
<img src="img/icons8-javascript-100.png" alt="Javascript Logo" class="nav-logo">
<div class="nav-links-container">
<a href="index.html" class="nav-links"><i class="fa-duotone fa-house"
style="--fa-primary-color: #000000; --fa-secondary-color: #ffd600; --fa-secondary-opacity: 1;"></i></a>
<div class="dropdown" id="dropdown">
<a href="javascript:void(0)" class="nav-links"><i class="fa-duotone fa-chalkboard-user"
style="--fa-primary-color: #000000; --fa-secondary-color: #ffd600; --fa-secondary-opacity: 1;"></i>
<span class="nav-link-text">
<!-- Activities -->
</span></a>
<div class="dropdown-content" id="dropdown-content">
<a href="class_activity_1.html">Class Activity 1</a>
<a href="class_activity_2.html">Class Activity 2</a>
<a href="class_activity_3.html">Class Activity 3</a>
</div>
</div>
<div class="dropdown" id="dropdown">
<a href="javascript:void(0)" class="nav-links"><i class="fa-duotone fa-clipboard-check"
style="--fa-primary-color: #000000; --fa-secondary-color: #ffd600; --fa-secondary-opacity: 1;"></i>
<span class="nav-link-text">
<!-- Assignments -->
</span></a>
<div class="dropdown-content" id="dropdown-content">
<a href="class_activity_1.html">Class Activity 1</a>
<a href="class_activity_2.html">Class Activity 2</a>
<a href="class_activity_3.html">Class Activity 3</a>
</div>
</div>
<div class="dropdown" id="dropdown">
<a href="javascript:void(0)" class="nav-links"><i class="fa-duotone fa-gear "
style="--fa-primary-color: #000000; --fa-secondary-color: #ffd600; --fa-secondary-opacity: 1;"></i>
<span class="nav-link-text">
<!-- Projects -->
</span></a>
<div class="dropdown-content" id="dropdown-content">
<a href="class_activity_1.html">Class Activity 1</a>
<a href="class_activity_2.html">Class Activity 2</a>
<a href="class_activity_3.html">Class Activity 3</a>
</div>
</div>
<a href="javascript:void(0)" class="nav-links"><i class="fa-duotone fa-user-tie"
style="--fa-primary-color: #000000; --fa-secondary-color: #ffd600; --fa-secondary-opacity: 1;"></i>
<span class="nav-link-text">
<!-- Activities -->
</span>
</a>
<a href="https://thehtmlcourse.vercel.app/" class="nav-links solid-white" target="_blank"><i
class="fa-brands fa-html5" style="color: #000;"></i>
<span class="nav-link-text">
<!-- Html Course -->
</span>
</a>
<a href="https://thecsscourse.vercel.app/" class="nav-links solid-white" target="_blank"><i
class="fa-brands fa-css3-alt" style="color: #000;"></i>
<span class="nav-link-text">
<!-- Css Course -->
</span>
</a>
</div>
</span>
<span class="bottom-section">
<div class="nav-links-container">
<a href="https://github.com/dDevAhmed/frontend_development_javascript_course" class="nav-links solid-white" target="_blank"><i
class="fa-brands fa-github" style="color: #000;"></i></a>
<a href="#" class="nav-links" id="light-mode" title="Night Mode"><i class="fa-duotone fa-lightbulb"
style="--fa-primary-color: #000000; --fa-secondary-color: #ffd600; --fa-secondary-opacity: 1;"></i></a>
</div>
</span>
</nav>
</aside>
<main class="main-container">
<header>
<span class="page-title">
<h3 id="head">Class Activity <span class="number">3</span></h3>
</span>
<span class="navigation">
<a href="class_activity_2.html"><i class="fa-regular fa-angle-left"></i></a>
<a href="class_activity_1.html">1</a>
<a href="class_activity_2.html">2</a>
<a href="#" class="current-page">3</a>
<a href="class_activity_4.html">4</a>
<a href="class_activity_5.html">5</a>
<a href="class_activity_4.html"><i class="fa-regular fa-angle-right"></i></a>
</span>
</header>
<section class="body-content">
<div class="activity-container activity-container-3">
<p class="section-heading">Task</p>
<ol>
<li><p>Changing the styling of a div container using css animation</p></li>
<li><p>Changing the background color of a div containerwith button event listener</p></li>
</ol>
<p class="section-heading">Solution</p>
<div class="boxes-container">
<span>
<p>styling the box using CSS animation</p>
<div class="box box-1" id="box-1">Box 1</div>
</span>
<span>
<p>using javascript event to style the box</p>
<div class="box box-2" id="box-2">Box 2</div>
<span class="button-container">
<button type="button" class="button-default" id="button-default" onclick="">Default</button>
<button type="button" class="button-red" id="button-red" onclick="">Red</button>
<button type="button" class="button-green" id="button-green" onclick="">Green</button>
<button type="button" class="button-blue" id="button-blue" onclick="">Blue</button>
</span>
</span>
</div>
</div>
</section>
<footer>
<!-- fixme - repo link -->
<p>Page's <a href="#">Repo</a></p>
</footer>
</main>
<script src="script.js"></script>
<script>
let box2 = document.getElementById('box-2');
let defaultButton = document.getElementById('button-default');
let redButton = document.getElementById('button-red');
let greenButton = document.getElementById('button-green');
let blueButton = document.getElementById('button-blue');
defaultButton.addEventListener('click', () => {
box2.style.background = 'black';
});
redButton.addEventListener('click', () => {
box2.style.background = 'red';
});
greenButton.addEventListener('click', () => {
box2.style.background = 'green';
});
blueButton.addEventListener('click', () => {
box2.style.background = 'blue';
});
</script>
</body>
</html>