Skip to content

Commit 0e2492b

Browse files
author
Vertika Jain
committed
Citizen Science Questions
1 parent 537ea1c commit 0e2492b

File tree

4 files changed

+375
-0
lines changed

4 files changed

+375
-0
lines changed

questions/app.js

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//using selectors inside the element
2+
3+
const questions = document.querySelectorAll(".question");
4+
for (let question of questions) {
5+
const btn = question.querySelector(".question-btn");
6+
btn.addEventListener("click", () => {
7+
for (let q of questions) {
8+
if (q !== question) {
9+
q.classList.remove("show-text");
10+
}
11+
}
12+
question.classList.toggle("show-text");
13+
})
14+
}
15+
16+
// traversing the dom
17+
18+
/* const questionBtn = document.querySelectorAll(".question-btn");
19+
console.log(questionBtn);
20+
for (let btn of questionBtn) {
21+
btn.addEventListener("click", (e) => {
22+
//e.currentTarget is as same as btn
23+
const question = e.currentTarget.parentElement.parentElement; // btn.parentElement.parentElement
24+
question.classList.toggle("show-text");
25+
})
26+
} */

questions/index.html

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Q & A</title>
7+
<!-- font awesome -->
8+
<link
9+
rel="stylesheet"
10+
href="./../fontawesome-free-5.12.0-web/css/all.min.css"
11+
/>
12+
<!-- extra fonts -->
13+
<link
14+
href="https://fonts.googleapis.com/css?family=Great+Vibes&display=swap"
15+
rel="stylesheet"
16+
/>
17+
<!-- styles -->
18+
<link rel="stylesheet" href="styles.css" />
19+
</head>
20+
<body>
21+
<section class="questions">
22+
<div class="title">
23+
<h2>Citizen Science Questions</h2>
24+
</div>
25+
<div class="section-center">
26+
<article class="question">
27+
<div class="question-title">
28+
<p>What is Citizen Science?</p>
29+
<button type="button" class="question-btn">
30+
<span class="plus-icon">
31+
<i class="far fa-plus-square"></i>
32+
</span>
33+
<span class="minus-icon">
34+
<i class="far fa-minus-square"></i>
35+
</span>
36+
</button>
37+
</div>
38+
<div class="question-text">
39+
<p>Citizen science is the practice of public participation and collaboration in scientific research to increase scientific knowledge.
40+
Through citizen science, people share and contribute to data monitoring and collection programs.</p>
41+
</div>
42+
</article>
43+
<article class="question">
44+
<div class="question-title">
45+
<p>Who can be involved in Citizen Science?</p>
46+
<button type="button" class="question-btn">
47+
<span class="plus-icon">
48+
<i class="far fa-plus-square"></i>
49+
</span>
50+
<span class="minus-icon">
51+
<i class="far fa-minus-square"></i>
52+
</span>
53+
</button>
54+
</div>
55+
<div class="question-text">
56+
<p>Collaboration in citizen science involves scientists and researchers working with the public.
57+
Community-based groups may generate ideas and engage with scientists for advice, leadership, and program coordination.
58+
Interested volunteers, students, and educators may network and promote new ideas to advance the understanding of the world.</p>
59+
</div>
60+
</article>
61+
<article class="question">
62+
<div class="question-title">
63+
<p>How is modern technology being used in Citizen Science?</p>
64+
<button type="button" class="question-btn">
65+
<span class="plus-icon">
66+
<i class="far fa-plus-square"></i>
67+
</span>
68+
<span class="minus-icon">
69+
<i class="far fa-minus-square"></i>
70+
</span>
71+
</button>
72+
</div>
73+
<div class="question-text">
74+
<p>Armed with phones that have built-in GPS receivers, volunteers can readily provide geo-location information about species or situations in real time.
75+
New networks and communities of interested citizen scientists are created each day to learn more about the world and how we can contribute to understanding it.
76+
In the future, more phones could be outfitted with smart sensors, which would let people measure and record environmental data, such as air-quality levels.</p>
77+
</div>
78+
</article>
79+
</div>
80+
</section>
81+
<!-- javascript -->
82+
<script src="app.js"></script>
83+
</body>
84+
</html>

questions/logo.svg

+17
Loading

questions/styles.css

+248
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,248 @@
1+
/*
2+
===============
3+
Fonts
4+
===============
5+
*/
6+
@import url("https://fonts.googleapis.com/css?family=Open+Sans|Roboto:400,700&display=swap");
7+
8+
/*
9+
===============
10+
Variables
11+
===============
12+
*/
13+
14+
:root {
15+
/* dark shades of primary color*/
16+
--clr-primary-1: hsl(205, 86%, 17%);
17+
--clr-primary-2: hsl(205, 77%, 27%);
18+
--clr-primary-3: hsl(205, 72%, 37%);
19+
--clr-primary-4: hsl(205, 63%, 48%);
20+
/* primary/main color */
21+
--clr-primary-5: #49a6e9;
22+
/* lighter shades of primary color */
23+
--clr-primary-6: hsl(205, 89%, 70%);
24+
--clr-primary-7: hsl(205, 90%, 76%);
25+
--clr-primary-8: hsl(205, 86%, 81%);
26+
--clr-primary-9: hsl(205, 90%, 88%);
27+
--clr-primary-10: hsl(205, 100%, 96%);
28+
/* darkest grey - used for headings */
29+
--clr-grey-1: hsl(209, 61%, 16%);
30+
--clr-grey-2: hsl(211, 39%, 23%);
31+
--clr-grey-3: hsl(209, 34%, 30%);
32+
--clr-grey-4: hsl(209, 28%, 39%);
33+
/* grey used for paragraphs */
34+
--clr-grey-5: hsl(210, 22%, 49%);
35+
--clr-grey-6: hsl(209, 23%, 60%);
36+
--clr-grey-7: hsl(211, 27%, 70%);
37+
--clr-grey-8: hsl(210, 31%, 80%);
38+
--clr-grey-9: hsl(212, 33%, 89%);
39+
--clr-grey-10: hsl(210, 36%, 96%);
40+
--clr-white: #fff;
41+
--clr-red-dark: hsl(360, 67%, 44%);
42+
--clr-red-light: hsl(360, 71%, 66%);
43+
--clr-green-dark: hsl(125, 67%, 44%);
44+
--clr-green-light: hsl(125, 71%, 66%);
45+
--clr-gold: #c59d5f;
46+
--clr-black: #222;
47+
--ff-primary: "Roboto", sans-serif;
48+
--ff-secondary: "Open Sans", sans-serif;
49+
--transition: all 0.3s linear;
50+
--spacing: 0.25rem;
51+
--radius: 0.5rem;
52+
--light-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
53+
--dark-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
54+
--max-width: 1170px;
55+
--fixed-width: 620px;
56+
}
57+
/*
58+
===============
59+
Global Styles
60+
===============
61+
*/
62+
63+
*,
64+
::after,
65+
::before {
66+
margin: 0;
67+
padding: 0;
68+
box-sizing: border-box;
69+
}
70+
body {
71+
font-family: var(--ff-secondary);
72+
background: var(--clr-grey-10);
73+
color: var(--clr-grey-1);
74+
line-height: 1.5;
75+
font-size: 0.875rem;
76+
}
77+
ul {
78+
list-style-type: none;
79+
}
80+
a {
81+
text-decoration: none;
82+
}
83+
img:not(.logo) {
84+
width: 100%;
85+
}
86+
img {
87+
display: block;
88+
}
89+
90+
h1,
91+
h2,
92+
h3,
93+
h4 {
94+
letter-spacing: var(--spacing);
95+
text-transform: capitalize;
96+
line-height: 1.25;
97+
margin-bottom: 0.75rem;
98+
font-family: var(--ff-primary);
99+
}
100+
h1 {
101+
font-size: 3rem;
102+
}
103+
h2 {
104+
font-size: 2rem;
105+
}
106+
h3 {
107+
font-size: 1.25rem;
108+
}
109+
h4 {
110+
font-size: 0.875rem;
111+
}
112+
p {
113+
margin-bottom: 1.25rem;
114+
color: var(--clr-grey-5);
115+
}
116+
@media screen and (min-width: 800px) {
117+
h1 {
118+
font-size: 4rem;
119+
}
120+
h2 {
121+
font-size: 2.5rem;
122+
}
123+
h3 {
124+
font-size: 1.75rem;
125+
}
126+
h4 {
127+
font-size: 1rem;
128+
}
129+
body {
130+
font-size: 1rem;
131+
}
132+
h1,
133+
h2,
134+
h3,
135+
h4 {
136+
line-height: 1;
137+
}
138+
}
139+
/* global classes */
140+
141+
.btn {
142+
text-transform: uppercase;
143+
background: transparent;
144+
color: var(--clr-black);
145+
padding: 0.375rem 0.75rem;
146+
letter-spacing: var(--spacing);
147+
display: inline-block;
148+
transition: var(--transition);
149+
font-size: 0.875rem;
150+
border: 2px solid var(--clr-black);
151+
cursor: pointer;
152+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
153+
border-radius: var(--radius);
154+
}
155+
.btn:hover {
156+
color: var(--clr-white);
157+
background: var(--clr-black);
158+
}
159+
/* section */
160+
.section {
161+
padding: 5rem 0;
162+
}
163+
164+
.section-center {
165+
width: 90vw;
166+
margin: 0 auto;
167+
max-width: 1170px;
168+
}
169+
@media screen and (min-width: 992px) {
170+
.section-center {
171+
width: 95vw;
172+
}
173+
}
174+
main {
175+
min-height: 100vh;
176+
display: grid;
177+
place-items: center;
178+
}
179+
/*
180+
===============
181+
Questions
182+
===============
183+
*/
184+
.title {
185+
margin-top: 15vh;
186+
margin-bottom: 4rem;
187+
}
188+
.title h2 {
189+
color: var(--clr-gold);
190+
font-family: "Great Vibes", cursive;
191+
text-align: center;
192+
}
193+
.section-center {
194+
max-width: var(--fixed-width);
195+
}
196+
.question {
197+
background: var(--clr-white);
198+
border-radius: var(--radius);
199+
box-shadow: var(--light-shadow);
200+
padding: 1.5rem 1.5rem 0 1.5rem;
201+
margin-bottom: 2rem;
202+
}
203+
.question-title {
204+
display: flex;
205+
justify-content: space-between;
206+
align-items: center;
207+
text-transform: capitalize;
208+
padding-bottom: 1rem;
209+
}
210+
.question-title p {
211+
margin-bottom: 0;
212+
letter-spacing: var(--spacing);
213+
color: var(--clr-grey-1);
214+
}
215+
.question-btn {
216+
font-size: 1.5rem;
217+
background: transparent;
218+
border-color: transparent;
219+
cursor: pointer;
220+
color: var(--clr-gold);
221+
transition: var(--transition);
222+
}
223+
.question-btn:hover {
224+
transform: rotate(90deg);
225+
}
226+
.question-text {
227+
padding: 1rem 0 1.5rem 0;
228+
border-top: 1px solid rgba(0, 0, 0, 0.2);
229+
}
230+
.question-text p {
231+
margin-bottom: 0;
232+
}
233+
/* hide text */
234+
.question-text {
235+
display: none;
236+
}
237+
.show-text .question-text {
238+
display: block;
239+
}
240+
.minus-icon {
241+
display: none;
242+
}
243+
.show-text .minus-icon {
244+
display: inline;
245+
}
246+
.show-text .plus-icon {
247+
display: none;
248+
}

0 commit comments

Comments
 (0)