-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
48 lines (46 loc) · 1.44 KB
/
Copy pathindex.html
File metadata and controls
48 lines (46 loc) · 1.44 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Ladakh Weather MUnner </title>
<style>
body {
font-family: Arial, sans-serif;
background: linear-gradient(to right, #2c3e50, #3498db);
color: #fff;
text-align: center;
padding: 2rem;
}
.weather-box {
background-color: rgba( 255, 255, 255, 0.2);
padding: 1rem;
border-radius: 10px;
display: inline-block;
margin-top: 20px;
}
</style>
</head>
<body>
<h1>🌄 Weather in Ladakh</h1>
<p>Coordinates: 34.1526°N, 77.5771°E</p>
<div class="weather-box" id="weather">Loading weather...</div>
<script>
const apiUrl = "https://api.open-meteo.com/v1/forecast?latitude=34.1526&longitude=77.5771¤t_weather=true";
fetch(apiUrl)
.then(res => res.json())
.then(data => {
const weather = data.current_weather;
document.getElementById("weather").innerHTML = `
<h2>${weather.temperature}°C</h2>
<p>Wind Speed: ${weather.windspeed} km/h</p>
<p>Time: ${weather.time}</p>
`;
})
.catch(err => {
document.getElementById("weather").textContent = "Unable to load weather data.";
console.error("Error:", err);
});
</script>
</body>
</html>