-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjquery_faq.html
326 lines (282 loc) · 10.1 KB
/
jquery_faq.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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Jquery FAQ</title>
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<style>
.invisible {
visibility: hidden
}
.highlight {
background: yellow;
}
dt {
font-weight: bold;
}
.bold {
font-weight: bold;
}
.boxy {
width: 200px;
height: 200px;
}
.tech {
background-image: url('/images/techparts.jpg');
background-size: cover;
}
.engineer {
background-image: url("images/engineer.jpg");
background-size: cover;
}
.nature {
background-image: url("images/nature.jpg");
background-size: cover;
}
</style>
</head>
<body>
<dl>
<dt>Who is the director of the National Park Service?</dt>
<dd>Charles F. "Chuck" Sams III is the Director of the National Park Service.
</dd>
<dt>What government agency oversees the National Park Service?
</dt>
<dd>The National Park Service is a bureau of the Department of the Interior. Directly overseeing
its operation is
the department's Assistant Secretary for Fish, Wildlife and Parks.
</dd>
<dt>How many employees are in the National Park Service?
</dt>
<dd>
<ul>
<li>Permanent, temporary, and seasonal employees: Approximately 20,000
</li>
<li>Volunteers: More than 279,000 in 2019
</li>
</ul>
</dd>
<dt>How old is the National Park System?
</dt>
<dd>The National Park Service was created by an act signed by President Woodrow Wilson on August
25, 1916.
Yellowstone National Park was established by an act signed by President Ulysses S. Grant on March 1, 1872, as
the nation's first national park.
</dd>
<dt>What is the origin of the National Park Service arrowhead?
</dt>
<dd>The arrowhead was authorized as the official National Park Service emblem by the Secretary of
the Interior on
July 20, 1951. The components of the arrowhead may have been inspired by key attributes of the National Park
System, with the sequoia tree and bison representing vegetation and wildlife, the mountains and water
representing scenic and recreational values, and the arrowhead itself representing historical and archeological
values.
</dd>
<dt>How many areas are in the National Park System?
</dt>
<dd>The system includes 424 areas covering more than 85 million acres in every state, the District
of Columbia,
American Samoa, Guam, Puerto Rico, and the Virgin Islands. These areas include national parks, monuments,
battlefields, military parks, historical parks, historic sites, lakeshores, seashores, recreation areas, scenic
rivers and trails, and the White House. Learn more about national park designations. See the complete list of
National Park Service units and related areas by type and number.
</dd>
<dt>What is the largest national park site? Smallest?
</dt>
<dd>
<ul>
<li>Largest: Wrangell-St. Elias National Park and Preserve, AK, at 13.2 million acres
</li>
<li>Smallest: Thaddeus Kosciuszko National Memorial, PA, at 0.02 acres
</li>
</ul>
</dd>
<dt>How many people visit the national parks?
</dt>
<dd>Total recreation visitors to the national parks in 2021: 297,115,406.
</dd>
<dt>Where can I find a park map?
</dt>
<dd>You can view maps on specific park websites or find national park, National Park System,
National Trails System,
and other maps.
</dd>
<dt>How do I make reservations for camping/lodging in national parks?
</dt>
<dd>For campground reservations, visit Recreation.gov. Not all parks participate in this service;
many campgrounds
are first come, first served. For more information on specific camping and lodging services offered at the
park(s) of your interest, please check specific park websites. You can also learn more about camping in national
parks and find a map of parks with camping opportunities.
</dd>
<dt>Can I bring my pet to a national park?
</dt>
<dd>Some national parks welcome pets—in developed areas, on many trails and campgrounds, and in
some lodging
facilities.
</dd>
<a href='#' class="toggle-btn">Toggle answers!</a>
</dl>
<h3 id="1">Park 1</h3>
<ul class="facts">
<li>Fact 1</li>
<li>Fact 2</li>
<li>Fact 3</li>
<li class="last">last</li>
</ul>
<h3 id="2">Park 2</h3>
<ul class="facts">
<li>Fact 1</li>
<li>Fact 2</li>
<li>Fact 3</li>
<li>last one</li>
</ul>
<div class="parent-div">
<h3 id="3">Park 3</h3>
<ul class="facts">
<li>Fact 1</li>
<li>Fact 2</li>
<li>Fact 3</li>
<li>VERY last one</li>
</ul>
</div>
<button class="btn-highlight">Highlight Last</button>
<div class="d-flex">
<div class="d-flex flex-column tech boxy picture-1">
<button class="swap-left">Swap</button>
</div>
<div class="d-flex flex-column boxy engineer picture-2">
<button class="swap-middle">Swap</button>
</div>
<div class="d-flex flex-column boxy nature picture-3">
<button class="swap-right">Swap</button>
</div>
</div>
<!--Jquery Script-->
<script src="js/jquery-3.6.4.js"></script>
<!--Custom internal JS-->
<script>
//Toggle hide on dd
$('.toggle-btn').click(() => {
$('dd').toggleClass('invisible')
})
//Highlight dt when clicked
$('dt').click((e) => {
e.preventDefault()
const target = e.target
console.log(target)
$(target).toggleClass('highlight')
})
//Highlight last list item
$('.btn-highlight').click(() => {
$('.facts').each((index, el) => {
// if using children with a selector
// const lastList = $(el).children('.last')
const lastList = $(el).children().last()
console.log(lastList);
$(lastList).toggleClass('highlight')
})
})
//highlight li's underneath clicked h3
$('h3').click((e) => {
const target = e.target
console.log($(target).next().children())
$(target).next().children().toggleClass('bold')
})
//highlight all li's underneath clicked h3 (DIRTY)
// $('h3').click((e) => {
// const targetID = e.target.id
// // console.log(targetID)
// // console.log($('.facts'))
// const factList = $('.facts')
// $(factList).each((i, el) => {
// if (targetID - 1 === 0) {
// $(el).children().toggleClass('bold')
// } else if (targetID - 1 !== 0) {
// $(factList[targetID - 1]).children().toggleClass('bold')
// $(factList[targetID]).children().toggleClass('bold')
// }
// })
// })
//BONUS (dirty solution) TODO find a way to use next and previous instead of classes
const left = $('.swap-left')
const middle = $('.swap-middle')
const right = $('.swap-right')
// The rules are the following:
// The left frame swaps to the right and takes the image from the frame in the center.
// The center frame swaps randomly to either the left or right.
// The right frame swaps to the left and takes the image from the frame in the center.
let clicked
//left button
$(left).click(() => {
if (!clicked) {
clicked = true
//remove tech class
$('.picture-1').removeClass('tech')
//add tech class to engineer div
$('.picture-1').addClass('engineer')
//remove engineer class
$('.picture-2').removeClass('engineer')
//add engineer class to tech div
$('.picture-2').addClass('tech')
} else {
clicked = false
//remove engineer class
$('.picture-1').removeClass('engineer')
//add engineer class to tech div
$('.picture-2').addClass('engineer')
//remove engineer class from tech
$('.picture-1').removeClass('engineer')
//add tech class to engineer div
$('.picture-1').addClass('tech')
}
})
//middle button
$(middle).click(() => {
if (!clicked) {
clicked = true
//remove engineer class
$('.picture-2').removeClass('engineer')
//add engineer class to nature div
$('.picture-3').addClass('engineer')
//remove nature class
$('.picture-3').removeClass('nature')
//add engineer class to tech div
$('.picture-2').addClass('nature')
} else {
clicked = false
//remove engineer class
$('.picture-3').removeClass('engineer')
//add engineer class
$('.picture-2').addClass('engineer')
//remove nature class
$('.picture-2').removeClass('nature')
//add nature class
$('.picture-3').addClass('nature')
} })
//right button
$(right).click(() => {
if (!clicked) {
clicked = true
//remove tech class
$('.picture-3').removeClass('nature')
//add tech class to engineer div
$('.picture-2').addClass('nature')
//remove tech class from engineer
$('.picture-2').removeClass('engineer')
//add engineer class to tech div
$('.picture-3').addClass('engineer')
} else {
clicked = false
//remove engineer class
$('.picture-2').removeClass('nature')
//add engineer class to tech div
$('.picture-2').addClass('engineer')
//remove engineer class from tech
$('.picture-3').removeClass('engineer')
//add tech class to engineer div
$('.picture-3').addClass('nature')
} })
</script>
</body>
</html>