FCC Local Weather
How do I make an fcc local weather?
What is a fcc local weather? How do you make a fcc local weather? This script and codes were developed by Victoria on 02 December 2022, Friday.
FCC Local Weather - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>FCC Local Weather</title>
</head>
<body> <button class="convert">°F / °C </button>
<div> <div class="current-city"></div> <span class="temperature"></span> <span class="measure"></span>
</div>
<img class="weather-img"/> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.2/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
FCC Local Weather - Script Codes JS Codes
const CELSIUM = 'Celsium';
const FAHRENHEIT = 'Fahrenheit';
const farCelSwitch = { 'C': 'F', 'F': 'C'
};
const farCelTitles = { 'C': CELSIUM, 'F': FAHRENHEIT
};
const setMeasure = m => { $('.measure').empty().append(farCelTitles[m]); $('.measure').data('measure', m);
};
const convert = () => { const measure = $('.measure').data('measure'); const currentTemp = $('.temperature').text(); const _conv = (value, measurement) => { return measurement === 'F' ? ((value - 32) * 5/9) : (value * 9/5 + 32); }; const printConvert = (value, measurement) => { const newMeasurement = farCelSwitch[measurement]; setMeasure(newMeasurement); $('.temperature').empty().append(_conv(value, newMeasurement).toFixed(2)); } printConvert(currentTemp, measure);
};
$('.convert').click(convert);
var weatherApp = () => { var weatherRequest = (pos) => { var lon = pos.coords.longitude; var lat = pos.coords.latitude; var url ='http://api.openweathermap.org/data/2.5/weather?lat=' + lat + '&lon=' + lon + '&units=metric' +'&APPID=038e9ad1a5f02051a3db265045994d1c'; $.get(url, (data) => { $('.current-city').append(data.name); $('.temperature').append(data.main.temp); setMeasure('C'); $('.weather-img').attr({ src: 'http://openweathermap.org/img/w/' + data.weather[0].icon + '.png' }); }) } navigator.geolocation.getCurrentPosition(weatherRequest);
};
$(weatherApp);
Developer | Victoria |
Username | Enieste |
Uploaded | December 02, 2022 |
Rating | 3 |
Size | 2,076 Kb |
Views | 10,120 |
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 |
FCC Tribute page | 3,327 Kb |
React konva | 4,721 Kb |
FCC Twitchtv JSON API | 3,446 Kb |
FCC Pomodoro | 3,618 Kb |
FCC Reacted Markdown | 2,685 Kb |
React TODO | 3,320 Kb |
FCC Tic Tac Toe | 5,602 Kb |
FCC Wiki viewer | 2,309 Kb |
FCC JS Calculator | 4,996 Kb |
FCC Recipe Box | 7,585 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 |
Pure CSS Read More Arrow | Zephyr | 1,747 Kb |
We Simplify animation | Meodai | 48,169 Kb |
Find The Penguin | Lelder | 2,212 Kb |
Tic Tac Toe | Volv | 4,862 Kb |
Formations | Cantelope | 5,731 Kb |
BabyStore | Pablo-Ai | 3,807 Kb |
Sketchy Box | Mnicpt | 3,033 Kb |
PNotify Demo | Adittmar | 1,731 Kb |
-2 base | Kozanecki_p | 1,641 Kb |
Console fun | Dviate | 1,500 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!