// Docs at http://simpleweatherjs.com /* Does your browser support geolocation? */ if ("geolocation" in navigator) { $('.js-geolocation').show(); } else { $('.js-geolocation').hide(); } /* Where in the world are you? */ $('.js-geolocation').on('click', function() { navigator.geolocation.getCurrentPosition(function(position) { loadWeather(position.coords.latitude+','+position.coords.longitude); //load weather using your lat/lng coordinates }); }); /* * Test Locations * Austin lat/long: 30.2676,-97.74298 * Austin WOEID: 2357536 */ $(document).ready(function() { loadWeather('Seattle',''); //@params location, woeid }); function loadWeather(location, woeid) { $.simpleWeather({ location: location, woeid: woeid, unit: 'c', success: function(weather) { html = '

'+weather.temp+'°'+weather.units.temp+'

'; html += ''; // html += '
  • '+weather.alt.temp+'°F
  • '; $(".weather-widget").html(html); }, error: function(error) { $(".weather-widget").html('

    '+error+'

    '); } }); }