-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.css
More file actions
103 lines (92 loc) · 2.3 KB
/
main.css
File metadata and controls
103 lines (92 loc) · 2.3 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
* {
font-family: Verdana, Geneva, Tahoma, sans-serif;
}
body {
background-color: #293251;
}
.container {
height: 400px;
width: 300px;
background-color: #F4F9FF;
border-radius: 15px;
}
.title {
font-size: x-large;
color: darkblue;
}
.notification {
background-color: #f8d7da;
color: #721c24;
font-size: medium;
}
.weather-container {
width: 300px;
height: 260px;
background-color: #8fa0b4;
}
.weather-icon {
width: 300px;
height: 128px;
}
.weather-icon img {
display: block;
margin: 0 auto;
}
.temperature-value {
width: 300px;
height: 60px;
}
.temperature-value p {
color: #e3e5eb;
font-size: larger;
/* text-align: center; */
cursor: pointer;
}
.description p {
padding: 8px;
margin: 0;
color: #293251;
text-align: center;
font-size: 1.2em;
}
.location p {
margin: 0;
padding: 0;
color: #293251;
text-align: center;
font-size: 0.8em;
}
/* function getResultByCity(city) {
let api_city = `http://api.openweathermap.org/data/2.5/weather?q=${city}&appid=${key}`;
fetch(api_city)
.then(function (response) {
//take the response given by api
let data = response.json();
console.log(data);
return data;
})
.then(function assignValObject(data) {
weather.tempreture.value = Math.floor(data.main.temp - KELVIN);
weather.description = data.weather[0].description;
weather.icon = data.weather[0].icon;
weather.location = data.name;
weather.country = data.sys.country;
weather.tempreture.min_ = Math.floor(data.main.temp - KELVIN);
weather.tempreture.max_ = Math.floor(data.main.temp - KELVIN);
display_weather();
});
function display_weather() {
loc.text(weather.location);
icon.html(`<img src="image/${weather.icon}.png">`);
desc.text(weather.description);
temp.text(`${weather.tempreture.value}°C`);
min_max_temp.text(`${weather.tempreture.min_}°C / ${weather.tempreture.max_}°C`);
}
}
// get city from user
let city = document.querySelector('#search');
city.addEventListener('keydown', function (event) {
if (event.keyCode == 13) {
getResultByCity(city.value);
}
}); */