Local Weather
How do I make an local weather?
What is a local weather? How do you make a local weather? This script and codes were developed by Jimmy Lin on 11 December 2022, Sunday.
Local Weather - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Local Weather</title> <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet">
<body> <div id="header"> <h1 class="text-center title"> Local Weather</h1> <div class="left"> <h2 class="text-center" id="currentLocation">Getting location...</h2> </div> <div id="container"> <h2 class="text-center content-title" id="currentTemp">... </h2> <h6 class="text-center"><a href="#" id="toggle">Toggle C/F</a></h6> <div class="content-body"> <p class="text-center" id='high-low'></p> <p class="text-center" id='currentWeather'>...</p> </div>
</div>
</body> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Local Weather - Script Codes CSS Codes
.title { font-family: lobster; font-size: 50px;
}
#container { margin-left:auto; margin-right:auto; border-style: solid; width:25%; border-color: grey;
}
body { font-family: Times;
}
p{ font-size:30px;
}
h6{ font-size:20px;
}
Local Weather - Script Codes JS Codes
//May work better in Safari in pulling the ipinfo.io
var API_KEY = "7c9a747b87d4de4adb63faae45e47e53";
var cel = false;
var wd;
function displayTemp(fTemp, c){ if(c) return Math.round((fTemp-32)*(5/9))+ " C"; return Math.round(fTemp)+ " F"
}
function render(wd, cel){ var currentLocation = wd.name; var currentWeather = wd.weather[0].description; var currentTemp = displayTemp(wd.main.temp, cel); var high = displayTemp(wd.main.temp_max, cel); var low = displayTemp(wd.main.temp_min, cel); var icon = wd.weather[0].icon; $('currentTemp').prepend('<div>this is prepended</div>') $('#currentLocation').html(currentLocation); $('#currentTemp').html(currentTemp); $("#currentWeather").html(currentWeather); $('#high-low').html(high+ " / " + low); var iconSrc = "http://openweathermap.org/img/w/"+ icon+ ".png"; $('#currentTemp').prepend('<img src="'+iconSrc+ '">');
}
$(function(){ var loc; $.getJSON('http://ipinfo.io', function(d){ console.log("Assigning Data") loc = d.loc.split(","); console.log(loc); $.getJSON('http://api.openweathermap.org/data/2.5/weather?units=imperial&lat='+ loc[0] + '&lon=' +loc[1]+'&APPID=' +API_KEY, function(apiData){ wd = apiData; render(apiData, cel); $('#toggle').click(function(){ cel = !cel; render(wd,cel); }) }) })
});

Developer | Jimmy Lin |
Username | odylic |
Uploaded | December 11, 2022 |
Rating | 3 |
Size | 2,560 Kb |
Views | 4,046 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Random Quote Generator | 2,674 Kb |
Mark Down Previewer | 3,062 Kb |
Twitch JSON API | 2,556 Kb |
Pomodoro Clock | 2,384 Kb |
Simon Game | 3,485 Kb |
Wikipedia Viewer | 2,333 Kb |
Portfolio Template | 2,581 Kb |
Portfolio Trial 1 | 3,730 Kb |
Firefly tribute | 2,476 Kb |
Tic Tac Toe Game | 2,701 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
CSS Hover Effects | Alen | 3,613 Kb |
Pure CSS Tooltips | Mobius1 | 2,271 Kb |
Slider css only | Armandobau | 2,161 Kb |
This in constructor context | _shree33 | 1,718 Kb |
Html5-canvas-snow-effect | MariamMassadeh | 2,609 Kb |
Portfolio Page | KaylaMT | 1,983 Kb |
Parallax scrolling scene | Iharosi | 2,485 Kb |
Minimal Menu | Achudars | 3,430 Kb |
Project Euler Problem 17 | Bfillmer | 2,739 Kb |
Background-blend-mode Test | 0x04 | 4,744 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!