Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


<meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Weather App</title>
<link rel="stylesheet" href="style.css">
<!-- bootstrap -->
<link rel="stylesheet" href="">
<link rel="text/javascript" href="app.js">

 <div class="container">
  <nav class="navbar navbar-inverse navbar-fixed-top">
   <div class="navbar-header">
    <a class="navbar-brand" href="#">Weather App</a>
   <!-- navbar-header -->

  <div class="spacer"></div>
  <div class="block">
   <h1 class="text-center"><span id="currentTemp"></span></h1>
   <h1 class="text-center"><span id="currentWeather"></span></h1>
   <span><a href="#" id="toggle">Celsius/Fahrenheit</a></span><br><br>

   <!-- weather infro -->
   You're in: <span id="country"></span><br> City of: <span id="city"></span><br> Latitude: <span id="latitude"></span><br> Longitude: <span id="longitude"></span><br>
  <div class="spacer"></div>
 <!-- container --><br>
 <footer id="footer">
  <ul class="nav navbar-nav">
   <p>&copy All rights reserved to
    <a href="" target="_blank">
			Charles Marlow</a></p>

 <!-- app's javascript -->
 <script src=""></script>
 <script type="text/javascript" src="app.js"></script>
 <!-- jQuery -->




                .block {
	background-color: black;
	opacity: 0.75;
	color: white;
	padding: 50px;
	width: 50%;
	margin-right: auto;
	margin-left: auto;
	border-radius: 15px;
	font-size: 1.5em;
	padding-bottom: 3%;

.spacer {
	padding: 5%;

body {
	background: no-repeat center center fixed;
	-webkit-background-size: cover;
	-mox-background-size: cover;
	background-size: cover;

#footer {
	background-color: black;
	opacity: 0.75;
	color: white;
	padding: 20px 0px 0px 120px;
	width: 35%;
	margin-right: auto;
	margin-left: auto;
	border-radius: 15px;
	font-size: 24px;
	padding-bottom: 3%;

#toggle {
	margin: 150px;
	font-size: 20px;



                /* This app fetches a user's geolocation using latitude/longitude
 data and delivers local current weather in return, using the API */

	var C = false;
	var apiData;
	var backgroundImg = [
		// 299
		// 499 drizzle
		// 599 rain
		// 699 snow
		// 799 fog
		// 800 clear
		// >800 cloudy
		// appid=de3cf8ea4a51adc3c85e1727f930042c 
	// display temps in Fahrenheit/Celsius
	function displayTemp(F, C){
		if (C) return Math.round((F - 32) * (5/9)) + "&deg; C";
		return Math.round(F) + "&deg; F";
	// render data
	function render(data, C){
		var currentWeather =[0].description;
		var currentTemp = displayTemp(data.main.temp, C);
		var icon =[0].icon;
		var iconSrc = "" + icon + ".png";
		$("#currentTemp").prepend("<img src=" +iconSrc + ">");
	// get user location using latitude/longitude
	$.getJSON("", function(location){
		//console.log(location); success
		$.getJSON("" + location.latitude + "&lon=" + location.longitude + "&units=imperial&APPID=81596f0998590acf3d21e58d3e7b4215", function(data){
			apiData = data;
			//console.log(apiData); success
			render(apiData, C);
				C = !C;
				render(apiData, C);
			var id =[0].id,
					bgId = [299, 499, 599, 699, 799, 800];
			bgIndex = bgId.sort().indexOf(id);
			//console.log(bgId); success
			$("body").css('background-image', 'url(' + backgroundImg[bgIndex] + ')');