Skip to content

Commit

Permalink
Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Leandro committed Jun 1, 2019
1 parent 32ace17 commit fabe057
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions js/localweather.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ $(document).ready(function () {
getGeoInfo();
});


function getGeoInfo() {

if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (geoData) {
let lat = geoData.coords.latitude;
let lon = geoData.coords.longitude;
navigator.geolocation.getCurrentPosition(geoData => {
lat = geoData.coords.latitude;
lon = geoData.coords.longitude;

getWeatherInfo(lat, lon);
});
Expand All @@ -38,10 +38,7 @@ async function getWeatherInfo(lat, lon) {
dataType: 'json'
});

let loc = `
${data.name}, ${data.sys.country}<br>
( ${lat.toFixed(4)}, ${lon.toFixed(4)} )
`;
let loc = `${data.name}, ${data.sys.country}`;

let icon = `https://openweathermap.org/img/w/${data.weather[0].icon}.png`;
let temp = data.main.temp.toFixed(0);
Expand Down

0 comments on commit fabe057

Please sign in to comment.