forked from OleksiyRudenko/a-tiny-JS-world
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
63 lines (52 loc) · 3.09 KB
/
test.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
const city = [
{
name: 'kyiv',
info: 'The capital of Ukraine and the most interesting city, cultural and spiritual capital of the country. Due to the hilly terrain, the town is very picturesque and has more than 20 lookouts. Please note that Kyiv is quite large and even the sightseeing tour takes 10 kilometers, so have at least 2 days for a visit.',
},
{
name: 'lviv',
info: 'Lvivs Old Town is a UNESCO World Heritage Site. This city is very popular among Ukrainians from other cities who often come here for the weekend. Recently Lviv turned to the restaurant capital of the country, due to a network of unusual restaurants "!FEST".',
},
{
name: 'kamianetspodilskyi',
info: 'Best small city in Ukraine. Rock towns are common for Italy or Spain, but in Ukraine it is very rare. Here is an oldest town hall in the country, a cozy old town and a fairy-tale castle.',
},
{
name: 'xxxxx',
info: 'Pretty unknown city, capital of the Bukovina region and cultural center of western Ukraine, along with Lviv. In 2012 was recognized the most comfortable city in the country. Known primarily for a luxurious building of the university, the former residence of the Metropolitan and UNESCO World Heritage site. Old Town is also beautiful.',
},
{
name: 'uzhgorod',
info: 'The capital of the Carpathian Ukraine is known for cherry blossoms in May, the castle and wine festivals. There is also a lovely old town.',
},
{
name: 'kharkiv',
info: 'The second largest city in the country, the former capital. The central Freedom Square is one of the biggest in Europe. It in 2008 Queen with Paul Rogers gathered here the largest audience in the history of the group. Kharkiv is famous for monumental Stalinist architecture, as well as important symbol of "constructivism" style - building of Gosprom.',
},
];
const defaultContent = {
name: 'kyiv',
info: 'The capital of Ukraine and the most interesting city, cultural and spiritual capital of the country. Due to the hilly terrain, the town is very picturesque and has more than 20 lookouts. Please note that Kyiv is quite large and even the sightseeing tour takes 10 kilometers, so have at least 2 days for a visit.',
};
//name city//
document.querySelector('.container-list').innerHTML = `<ul class='menu-list'></ul>`;
const buildMenu = city => {
const items = [];
city.map((val, id) => {
let nameCity = document.createElement('li');
nameCity.innerHTML = `<a href="#" class='list-link'>${val.name}</a>`;
document.querySelector('.menu-list').appendChild(nameCity);
});
};
console.log(buildMenu(city));
//info city//
const menuButton = document.querySelector('.menu-list');
menuButton.addEventListener('click', function (e) {
document.querySelector('.container__main').innerHTML;
const info = [];
city.map((val, id) => {
let infoCity = document.createElement('div');
infoCity.innerHTML = `<p class='info'>${val.info}</p>`;
document.querySelector('.container__main').appendChild(infoCity);
});
});