-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from MonishRaman/Main
The Weather Forecasting has been verified and done successfully
- Loading branch information
Showing
6 changed files
with
295 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,236 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>Weather App</title> | ||
<link rel="icon" href="logo.png"> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" | ||
integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous"> | ||
<link rel="stylesheet" href="style.css"> | ||
</head> | ||
|
||
<body background="nice-beach-suning-weather-hd-wallapaper.jpg"> | ||
|
||
<nav class="navbar navbar-expand-lg bg-body-tertiary"> | ||
<div class="container-fluid"> | ||
<a class="navbar-brand" href="#">⛅Weather App</a> | ||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" | ||
data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" | ||
aria-label="Toggle navigation"> | ||
<span class="navbar-toggler-icon"></span> | ||
</button> | ||
<div class="collapse navbar-collapse" id="navbarSupportedContent"> | ||
<ul class="navbar-nav me-auto mb-2 mb-lg-0"> | ||
<li class="nav-item"> | ||
<a class="nav-link active" aria-current="page" href="#">Home</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="#">About this App</a> | ||
</li> | ||
<li class="nav-item dropdown"> | ||
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" | ||
aria-expanded="false"> | ||
|
||
</a> | ||
<ul class="dropdown-menu"> | ||
<li><a class="dropdown-item" href="#">Delhi</a></li> | ||
<li><a class="dropdown-item" href="#">Seattle</a></li> | ||
<li> | ||
<hr class="dropdown-divider"> | ||
</li> | ||
<li><a class="dropdown-item" href="#">Bangalore</a></li> | ||
</ul> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link">Usage Guide</a> | ||
</li> | ||
</ul> | ||
<form class="d-flex" role="search"> | ||
<input id="city" class="form-control me-2" type="search" placeholder="Search" aria-label="Search"> | ||
<button class="btn btn-outline-success" type="submit" id="submit">Search</button> | ||
</form> | ||
</div> | ||
</div> | ||
</nav> | ||
|
||
|
||
|
||
|
||
<div class="container"> | ||
<h1 class="my-4 text-center">Weather for <span id="cityName"></span></h1> | ||
<main> | ||
<div class="row row-cols-1 row-cols-md-3 mb-3 text-center"> | ||
<div class="col"> | ||
<div class="card mb-4 rounded-3 shadow-sm"> | ||
<div class="card-header py-3" style="background-color:#0d6efd; color: white;"> | ||
<h4 class="my-0 fw-normal">Temperatures</h4> | ||
</div> | ||
<div class="card-body"> | ||
<h1 class="card-title pricing-card-title"><span id="temp2"></span><small | ||
class="text-body-secondary fw-light"><span>℃</span></small></h1> | ||
<ul class="list-unstyled mt-3 mb-4"> | ||
<li>Temperature is <span id="temp"></span></li> | ||
<li>Min Temperature is <span id="min_temp"></span></li> | ||
<li>Max Temperature is <span id="max_temp"></span></li> | ||
|
||
</ul> | ||
<button type="button" class="w-100 btn btn-lg btn-outline-primary" style="background-color: #0d6efd;color: white;">Temperature Info</button> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="col"> | ||
<div class="card mb-4 rounded-3 shadow-sm"> | ||
<div class="card-header py-3" style="background-color: #0d6efd;color: white;"> | ||
<h4 class="my-0 fw-normal">Humidity Info</h4> | ||
</div> | ||
<div class="card-body"> | ||
<h1 class="card-title pricing-card-title"><span id="humidity2"></span><small | ||
class="text-body-secondary fw-light"> %</small></h1> | ||
<ul class="list-unstyled mt-3 mb-4"> | ||
<li>Wind Degree is <span id="wind_degrees"></span></li> | ||
<li>Feels like <span id="feels_like"></span></li> | ||
<li>Humidity is <span id="humidity"></span></li> | ||
</ul> | ||
<button type="button" class="w-100 btn btn-lg btn-primary">Humidity Info</button> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="col"> | ||
<div class="card mb-4 rounded-3 shadow-sm border-primary"> | ||
<div class="card-header py-3 text-bg-primary border-primary"> | ||
<h4 class="my-0 fw-normal">Sun Info</h4> | ||
</div> | ||
<div class="card-body"> | ||
<h1 class="card-title pricing-card-title"><span id="wind_speed2"></span><small | ||
class="text-body-secondary fw-light"> km/hr</small></h1> | ||
<ul class="list-unstyled mt-3 mb-4"> | ||
|
||
<li>Wind Speed is <span id="wind_speed"></span></li> | ||
<li>Sunrise Time is <span id="sunrise"></span></li> | ||
<li>Sunset Time is <span id="sunset"></span></li> | ||
|
||
</ul> | ||
<button type="button" class="w-100 btn btn-lg btn-primary">Wind Info</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<h2 class="display-6 text-center mb-4">Weather of other Commom Places</h2> | ||
|
||
<div class="table-responsive"> | ||
<table class="table text-center"> | ||
<thead> | ||
<tr> | ||
<th style="width: 34%;"></th> | ||
<th style="width: 22%;"> Cloud_pct</th> | ||
<th style="width: 22%;">Feels_like</th> | ||
<th style="width: 22%;">Humidity</th> | ||
<th style="width: 22%;">Max_temp</th> | ||
<th style="width: 22%;">Min_temp</th> | ||
<th style="width: 22%;">Sunrise</th> | ||
<th style="width: 22%;">Sunset</th> | ||
<th style="width: 22%;">Temp</th> | ||
<th style="width: 22%;">Wind_degrees</th> | ||
<th style="width: 22%;">Wind_speed</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<th scope="row" class="text-start">Bangalore</th> | ||
|
||
<td>40</td> | ||
<td>23</td> | ||
<td>23</td> | ||
<td>88</td> | ||
<td>23</td> | ||
<td>23</td> | ||
<td>5.14</td> | ||
<td>230</td> | ||
<td>1694651927</td> | ||
<td>1694695937</td> | ||
|
||
</tr> | ||
<tr> | ||
<th scope="row" class="text-start">Chennai</th> | ||
<td>75</td> | ||
<td>29</td> | ||
<td>35</td> | ||
<td>81</td> | ||
<td>27</td> | ||
<td>29</td> | ||
<td>4.12</td> | ||
<td>150</td> | ||
<td>1694651283</td> | ||
<td>1694695297</td> | ||
|
||
</tr> | ||
</tbody> | ||
|
||
<tbody> | ||
<tr> | ||
<th scope="row" class="text-start">Hyderabad</th> | ||
<td> 75</td> | ||
<td> 25</td> | ||
<td> 26</td> | ||
<td> 83</td> | ||
<td> 24</td> | ||
<td> 25</td> | ||
<td> 2.06</td> | ||
<td> 280</td> | ||
<td> 1694651642</td> | ||
<td> 1694695804</td> | ||
</tr> | ||
<tr> | ||
<th scope="row" class="text-start">Pune</th> | ||
<td> 39</td> | ||
<td> 22</td> | ||
<td> 23</td> | ||
<td> 90</td> | ||
<td> 22</td> | ||
<td> 22</td> | ||
<td> 3.31</td> | ||
<td> 255</td> | ||
<td> 1694652730</td> | ||
<td> 1694696933</td> | ||
</tr> | ||
<tr> | ||
<th scope="row" class="text-start">Noida</th> | ||
<td> 100</td> | ||
<td> 32</td> | ||
<td> 37</td> | ||
<td> 58</td> | ||
<td> 32</td> | ||
<td> 32</td> | ||
<td> 2.14</td> | ||
<td> 133</td> | ||
<td> 1694651697</td> | ||
<td> 1694696298</td> | ||
</tr> | ||
<tr> | ||
<th scope="row" class="text-start">Delhi</th> | ||
<td> 40</td> | ||
<td> 32</td> | ||
<td> 39</td> | ||
<td> 70</td> | ||
<td> 32</td> | ||
<td> 32</td> | ||
<td> 2.57</td> | ||
<td> 140</td> | ||
<td> 1694651722</td> | ||
<td> 1694696327</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</main> | ||
</div> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" | ||
integrity="sha384-HwwvtgBNo3bZJJLYd8oVXjrBZt8cqVSpeBNS5n7C8IVInixGAoxmnlMuBnhbgrkm" | ||
crossorigin="anonymous"></script> | ||
<script src="script.js"></script> | ||
</body> | ||
|
||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
const options = { | ||
method: 'GET', | ||
headers: { | ||
'X-RapidAPI-Key': '2c06e2f780msh3f81c0245629ba6p19a960jsn5eff9cb95a57', | ||
'X-RapidAPI-Host': 'weather-by-api-ninjas.p.rapidapi.com' | ||
} | ||
}; | ||
const getWeather = (city) => { | ||
cityName.innerHTML = city | ||
fetch('https://weather-by-api-ninjas.p.rapidapi.com/v1/weather?city=' + city, options) | ||
.then(response => response.json()) | ||
.then((response) => { | ||
console.log(response) | ||
|
||
// cloud_pct.innerHTML = response.cloud_pct | ||
temp.innerHTML = response.temp | ||
temp2.innerHTML = response.temp | ||
feels_like.innerHTML = response.feels_like | ||
humidity.innerHTML = response.humidity | ||
humidity2.innerHTML = response.humidity | ||
min_temp.innerHTML = response.min_temp | ||
max_temp.innerHTML = response.max_temp | ||
wind_speed.innerHTML = response.wind_speed | ||
wind_speed2.innerHTML = response.wind_speed | ||
wind_degrees.innerHTML = response.wind_degrees | ||
sunrise.innerHTML = response.sunrise | ||
sunset.innerHTML = response.sunset | ||
|
||
}) | ||
.catch(err => console.error(err)); | ||
|
||
} | ||
|
||
submit.addEventListener("click", (e) => { | ||
e.preventDefault() | ||
getWeather(city.value) | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
h1,h2{ | ||
color:#ffe189; | ||
font-weight: 400; | ||
} | ||
|
||
.card-header py-3{ | ||
background-color: #0d6efd; | ||
color:white | ||
} | ||
|
||
.w-100 btn btn-lg btn-outline-primary{ | ||
background-color: #0d6efd; | ||
color: white; | ||
} | ||
|
||
|
||
|
||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters