Local Weather

2,656 Kb

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 Sudipta Das on 21 January 2023, Saturday.

Local Weather Previews

Local Weather - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Local Weather</title> <link href='https://fonts.googleapis.com/css?family=Crete+Round' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Oxygen:400' rel='stylesheet' type='text/css'> <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
<div class="outer text-center"> <div class="location"></div> <div class="temp"></div> <div class="weather"></div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>

Local Weather - Script Codes CSS Codes

.location{ font-family: 'Crete Round', serif; font-size:30px;
.weather,.temp{ font-family: 'Oxygen', sans-serif; font-size:30px;
background:url("https://s18.postimg.org/p2dn96cvt/lone_tree_2_wallpaper_1366x768.jpg") no-repeat center center fixed;
background:url("https://s10.postimg.org/gtpjdwe3t/armenia_hayks_aragats_wallpaper_1366x768.jpg") no-repeat center center fixed;
background:url("https://s11.postimg.org/62demnjub/african_landscape_wallpaper_1366x768.jpg") no-repeat center center fixed;

Local Weather - Script Codes JS Codes

var flag=0;
$(document).ready(function(){ if(navigator.geolocation){ console.log('y'); navigator.geolocation.getCurrentPosition(function(pos){ console.log('y11'); lat=pos.coords.latitude; long=pos.coords.longitude;	var xmlhttp=new XMLHttpRequest(); var url='http://api.openweathermap.org/data/2.5/weather?lat='+lat+'&lon='+long+'&appid=44db6a862fba0b067b1930da0d769e98'; console.log('y2'); xmlhttp.open('GET',url,false); xmlhttp.send(null); console.log('y3'); myArr= JSON.parse(xmlhttp.responseText); $('.location').html(myArr.name+', '+myArr.sys.country); $('.country').html(); $('.temp').html('<span class="glyphicon glyphicon-refresh conv" style="font-size:15px" onclick=convert()></span> <span class="tp">'+ Math.round(myArr.main.temp-273.15)+'</span> <span class="uni">C</span>'); $('.weather').html(myArr.weather[0].description); console.log('y4'); x(); }); }
function x(){ if($('.tp').text()<40 && $('.tp').text()>=9) { console.log('x'); $('body').addClass('mid'); }
if($('.tp').text()<9) { console.log('x2'); $('html').addClass('cold'); }
if($('.tp').text()>=40) { $('html').addClass('hot'); }
function convert(){ if(flag==0) { var tmp=$('.tp').text(); tmp=Math.round((tmp*1.8)+32); $('.tp').text(tmp); $('.uni').text('F'); flag=1; return null; } if(flag==1) { var tmp=$('.tp').text(); tmp=Math.round((tmp-32)*0.5556); $('.tp').text(tmp); $('.uni').text('C'); flag=0; return null; }
Local Weather - Script Codes
Local Weather - Script Codes
Home Page Home
Developer Sudipta Das
Username sdas13
Uploaded January 21, 2023
Rating 3
Size 2,656 Kb
Views 4,048
Do you need developer help for Local Weather?

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!

Sudipta Das (sdas13) Script Codes
CSS framework
Onepush - best websites
Wiki Viewer 1
CSS popup
Random Quotes
JS and The DOM
Javascript DOM
Create amazing video scripts with AI!

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!