Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //CHECK IF GEOLOCATION IS AVAILABLE
- if ("geolocation" in navigator) {
- $('#locate').show();
- } else {
- $('#locate').hide();
- }
- //LOCATION UPDATE
- $('#locate').on('click', function() {
- navigator.geolocation.getCurrentPosition(function(position) {
- loadWeather(position.coords.latitude+','+position.coords.longitude);
- });
- });
- $(document).ready(function() {
- loadWeather(); <------ For some fucked-up Reason this doesn't work.
- setInterval(loadWeather, 60000); //Update the weather every 5 minutes.
- });
- function loadWeather(location, woeid) {
- $.simpleWeather({
- location: location,
- woeid: woeid,
- unit: 'c',
- success: function(weather){
- console.log(weather.title);
- var iconHolder = $('#icon')[0];
- //COLOURS
- var orange = "#F2B441";
- var lightBlue = "#A0CCFF";
- var darkBlue = "#23568F";
- var icon = document.getElementById("icon");
- var adj = document.getElementById("adj");
- var bg = document.body;
- /*======================================================== ETC ==========================================*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement