-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame_parks.js
73 lines (66 loc) · 3.15 KB
/
game_parks.js
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
const gameParks = [
{
name: 'Bwindi Impenetrable National Park',
image: 'https://www.silverbackgorillatours.com/wp-content/uploads/2019/03/game-parks-of-uganda.jpg',
summary: 'Gorilla trekking and the gorilla habituation',
description: 'Bwindi Impenetrable National Park is UNESCO World heritage site because of the mountain gorillas and overall biodiversity',
},
{
name: 'Kibale National Park',
image: 'https://www.silverbackgorillatours.com/wp-content/uploads/2019/03/game-parks-in-uganda.jpg',
summary: 'chimpanzee tracking',
description: 'Kibale Forest is known as the primate capital of Uganda. There are more primates here than anywhere else in Uganda – over 13 species including chimpanzees.',
},
{
name: 'Kidepo Valley National Park',
image: 'https://www.silverbackgorillatours.com/wp-content/uploads/2019/03/national-park-uganda.jpg',
summary: 'ostriches, cheetahs and wild dogs',
description: 'Kidepo is one of Uganda’s true hidden gems. the only park in Uganda where ostriches, cheetahs and wild dogs still thrive',
},
{
name: 'Lake Mburo National Park',
image: 'https://www.silverbackgorillatours.com/wp-content/uploads/2019/03/uganda-national-parks.jpg',
summary: 'The smallest savannah park in Uganda',
description: 'It is the best place in Uganda to spot zebras, Leopards and Impala because of the high concentration in a small area.',
},
{
name: 'Mgahinga Gorilla National Park',
image: 'https://www.silverbackgorillatours.com/wp-content/uploads/2019/03/national-parks-of-uganda.jpg',
summary: 'The smallest national park',
description: 'Mgahinga is the smallest national park in Uganda. It is the second home to mountain gorillas in Uganda. ',
},
{
name: 'Mount Elgon National Park',
image: 'https://www.silverbackgorillatours.com/wp-content/uploads/2019/03/parks-in-uganda.jpg',
summary: 'Climb a volcano',
description: 'Climbing Mount Elgon is the main activity in the park but there are several animal species that can be spotted at the foot of the mountain and surrounding areas',
},
];
const createParkContent = (park) => `
<div class="image">
<img src="${park.image}" alt="${park.name}">
</div>
<div class="card-content">
<h3 class="title">${park.name}</h3>
<h4 class="subtitle">${park.summary}</h4>
<hr>
<p class="decription">${park.description}</p>
</div>
`;
const addPark = (park) => {
const parks = document.querySelector('.parks ul');
const li = document.createElement('li');
li.innerHTML = createParkContent(park);
parks.appendChild(li);
};
const createParks = () => {
const isDesktop = window.matchMedia('screen and (min-width:768px)').matches;
if (isDesktop) gameParks.forEach(addPark);
else gameParks.slice(0, 2).forEach(addPark);
};
createParks();
const moreButton = document.querySelector('.more');
moreButton.addEventListener('click', () => {
gameParks.slice(2).forEach(addPark);
moreButton.classList.add('no-display');
});