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 |
Firefly tribute | 2,476 Kb |
Random Quote Generator | 2,674 Kb |
RPG Style Text Dialogue | 2,635 Kb |
Wikipedia Viewer | 2,333 Kb |
Tic Tac Toe Game | 2,701 Kb |
Calculator | 2,544 Kb |
TwitchTV JSON API 2 | 2,691 Kb |
Mark Down Previewer | 3,062 Kb |
Portfolio Trial 1 | 3,730 Kb |
Pomodoro Clock | 2,384 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 |
Simple jQuery Slider | Jurbank | 2,874 Kb |
CSS3 Form | Tusharbandal | 1,836 Kb |
Chuck Norris Background | Manz | 1,967 Kb |
Fullscreen audio play button | 72 | 2,148 Kb |
Login-ng-modal | Heedoo | 3,566 Kb |
IbrahimJabbari-Effect21 | Ibrahimjabbari | 1,882 Kb |
Faces SVG animation | ScavengerFrontend | 2,957 Kb |
CSS-Flexbox-Demo | Sstiglets | 1,709 Kb |
CSS Hover Effects | Alen | 3,613 Kb |
Parallax scrolling scene | Iharosi | 2,485 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!