-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparks.html
More file actions
218 lines (184 loc) · 8.58 KB
/
parks.html
File metadata and controls
218 lines (184 loc) · 8.58 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Parks</title>
<style>
.highlighter {
background-color: yellow;
}
</style>
</head>
<body>
<h1>National Parks FAQ</h1>
<dl>
<dt>How many people visit the national parks?</dt>
<dd>Total recreation visitors to the national parks in 2018: 318,211,833.</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.</dd>
<dt>How many employees are in the National Park Service?</dt>
<dd>Permanent, temporary, and seasonal employees: More than 20,000</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.
</dd>
<dt>How many areas are in the National Park System?</dt>
<dd>The system includes 419 areas covering more than 85 million acres in every state, the District of Columbia,
American Samoa, Guam, Puerto Rico, and the Virgin Islands.
</dd>
<dt>What is the largest national park site?</dt>
<dd>Wrangell-St. Elias National Park and Preserve, AK, at 13.2 million acres.</dd>
<dt>What is the National Park Service budget?</dt>
<dd>Fiscal Year (FY) 2014 Enacted: $2.98 billion.</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>
<dt>How do I apply for a job with the National Park Service?</dt>
<dd>National Park Service jobs, including both permanent and seasonal positions, are listed on "USA JOB"s.</dd>
<dt>What do I need to know about driving off-road in national parks?</dt>
<dd>Before you head out, check with the national parks that you intend to visit. In many national parks, off-road
driving is illegal. Where off-road driving is allowed, the National Park Service regulates it.
</dd>
</dl>
<h3 class="park-Names">Yellowstone National Park</h3>
<ul class="park-Facts">
<li>Park originally had different name.</li>
<li>Yellowstone Lake is the largest high-elevation lake in North America.</li>
<li>Has largest bison population on public land.</li>
<li>Sits on an active Volcano.</li>
</ul>
<h3 class="park-Names">Guadalupe Mountains National Park</h3>
<ul class="park-Facts">
<li>Has the largest exposed fossil reef on Earth.</li>
<li>"El Capitan" is a 1,000-foot-high limestone cliff.</li>
<li>Comprises 76293 acres of mountain and desert land in West Texas.</li>
<li>location of the greatest mass extinction of all time.</li>
</ul>
<h3 class="park-Names">Big Bend National Park</h3>
<ul class="park-Facts">
<li>Larger than the state of Rhode Island.</li>
<li>Park protects over 1,200 species of plants, and over 580 species of birds, reptiles and mammals combined.</li>
<li>Spans along the Rio Grande.</li>
<li>Home to over 10,000 archaeological sites.</li>
</ul>
<button type="button" id="lastLiColor">Now in 'Yellow!'</button>
<script>
// this will make all the children of the first parent .park-Facts change color
// const lastYellow = document.querySelector(".park-Facts").children;
// for (let i = 0; i < lastYellow.length; i++) {
// lastYellow[i].style.color = "yellow";
// }
// // this will select and change color for all children of parent .park-Facts
// const lastYellow = document.querySelectorAll(".park-Facts");
// for (let i = 0; i < lastYellow.length; i++) {
// lastYellow[i].style.color = "yellow";
// }
// this will change all the last children of each .park-Facts parent
// const lastYellow = document.querySelectorAll(".park-Facts");
// for (let i = 0; i < lastYellow.length; i++) {
// lastYellow[i].lastElementChild.style.color = "yellow";
// }
// this will make all last element children change to yellow when the button is clicked
document.querySelector("#lastLiColor").addEventListener("click", function () {
const lastYellow = document.querySelectorAll(".park-Facts");
for (let i = 0; i < lastYellow.length; i++) {
lastYellow[i].lastElementChild.style.color = "yellow";
}
});
// Farrukh's Example=========================================================
// const listitems = document.querySelectorAll("li");
// document.querySelector('#btn').addEventListener('click', function (){
// const uls = document.querySelectorAll("ul");
// for(const ul of uls) {
// ul.lastElementChild.classList.add("highlighter");
// }
// })
// ========================================================================
// Johnny's Example===========================================================
// // TARGETING ALL H3s AND STORING THEM IN allH3s VARIABLE
// const allH3s = document.querySelectorAll("h3");
//
// // CREATING A LISTENER FUNCTION WITH LOGIC/EXECUTABLE CODE
// function listBgColorYellow () {
// // USING A forEach TO LOOP THROUGH ALL MY H3 ELEMENTS
// allH3s.forEach((eachIndividualH3)=> {
// // vvv ALL H3 ELEMENTS; vvv LAST LI IN UL;
// eachIndividualH3.nextElementSibling.lastElementChild.style.backgroundColor = "yellow";
// // ^^^ NEXT SIBLING (ULs); ^^^ DO THE STYLING;
// })
// }
// // vvv TARGETING MY YELLOW BG BUTTON;
// let yellowBtn = document.getElementById("yellow-BG");
// // vvv SETTING EVENT LISTENER ON MY BUTTON.
// yellowBtn.addEventListener("click", listBgColorYellow);
// // ^^^CLICK EVENT ^^^ CALLING MY FUNCTION
// ==============================================================================
// this will make all the children of the first .park-Names parent, bold
// document.querySelector(".park-Names").addEventListener("click", function (){
// const makeBold = document.querySelector(".park-Facts").children;
// for (let i = 0; i <makeBold.length; i ++) {
// makeBold[i].style.fontWeight = "bold";
// }
// });
// this makes all the children of the first .park-Names parent bold when any of the .park-names parents are pressed
// MY ORIGINAL CODE
// const parkParent = document.querySelectorAll(".park-Names");
// const makeBold = document.querySelector(".park-Facts").children;
//
// // let myFunction = function () {
// for (let i = 0; i < parkParent.length; i++) {
// parkParent[i].addEventListener("click", function () {
// for (let i = 0; i < makeBold.length; i++) {
// makeBold[i].style.fontWeight = "bold";
// }
// });
// }
// FARRUKH FIXED
const parkParent = document.querySelectorAll(".park-Names");
const makeBold = document.querySelectorAll(".park-Facts");
for (let i = 0; i < parkParent.length; i++) {
parkParent[i].addEventListener("click", function () {
makeBold[i].style.fontWeight = "bold";
});
}
// Farrukh's Example
// const h3s = document.querySelectorAll('h3');
//
// for (const h3 of h3s) {
// h3.addEventListener('click', function () {
// const lis = this.nextElementSibling.children;
// for( const li of lis) {
// li.style.fontWeight = "bold";
// }
// })
// }
// parkParent.addEventListener('click', myFunction())
// parkParent.forEach(makeBold => makeBold.addEventListener('click', event));
// MY ORIGINAL CODE
// const liClick = document.getElementsByClassName('li');
// liClick.parentElement.firstElementChild.addEventListener("click", function () {
// for (let i = 0; i < liClick.length; i++) {
// console.log(liClick);
// liClick[i].style.color = "blue";
// }
// });
// FARRUKH FIXED
const liClick = document.querySelectorAll('li');
for (let i = 0; i < liClick.length; i++) {
liClick[i].addEventListener('click', function () {
liClick[i].parentElement.firstElementChild.style.color = "blue";
})
}
// Farrukh's Example
// const listItems = document.querySelectorAll("li");
//
// for (const listItem of listItems) {
// listItem.addEventListener('click', function (){
// this.parentElement.firstElementChild.style.color = 'blue';
// })
// }
// ==================================================================================
</script>
</body>
</html>