Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

            
              <body>
	<link href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300" rel="stylesheet">

	<div class="container">
		<div class="row">
			<div class="col-md-12">
				<h1 class="text-center">Weather</h1>
				<hr>
				<h2 class="text-center">Here's your daily forcast for: <span id="location"></span></h2>
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-md-12 text-center">
			<div id="temp">
				<h2>The current temperature is: <span id="temperature"></span> <span id="weather_icon"><span id="toggle_ForC">F</span></span><h2>
						<h2>Right now it is: <span id="weather"></span><h2>
							<i id="icon_changer"></i>
							<br>
							<br>
				</div>
			</div>
				</div>
  				<div class="row">
						<div class="col-sm-12 text-center">
					<footer id="foot"><a href="https://darksky.net/poweredby/">Powered by Darksky</a>
						<br>
						<a id="me"  href="https://codepen.io/Bazill/full/pNvqyZ/">Created by Bazill</a>
						</footer>
						</div>
						</div>
						</div>
						
</body>
            
          
!

CSS

            
              body {
  background-image: url("https://www.pixelstalk.net/wp-content/uploads/2016/07/Weather-Background-HD.jpg");
	
font-family: 'Open Sans Condensed', sans-serif;	
}

/* Begin wallpaper switch classes */

.partlyCloudy{
	background: url("https://www.walldevil.com/wallpapers/a79/nature-wallpapers-wallpaper-background-desktop-weather-alone-tree-cloudy.jpg");
}

.partlyCloudyNight {
	background: url("http://cdn.wallpapersafari.com/34/35/L8P4Xg.jpg");
	background-size: cover;
}

.cloudy {
	background: url("http://cdn.wallpapersafari.com/86/40/NShrsK.jpg");
	background-size: cover;
}

.rain {
	background: url("https://www.pixelstalk.net/wp-content/uploads/2016/07/Weather-Background-HD.jpg");
	background-size: cover;
}

.fog {
	background: url("http://cdn.wallpapersafari.com/80/65/GA1R9s.jpg");
	background-size: cover;
}

.wind {
		background: url("http://cdn.wallpapersafari.com/78/23/h4aZxI.jpg");
	background-size: cover;
}

.snow {
	background: url("https://i0.wp.com/cdn.desktopwallpapers4.me/wallpapers/photography/1680x1050/2/18388-lamppost-in-the-snowy-park-1680x1050-photography-wallpaper.jpg");
	background-size: cover;
}

.sleet {
		background: url("https://wallpaperscraft.com/image/black_white_quay_bridge_sleet_evening_10883_1920x1080.jpg");
	background-size: cover;
}

.clearDay{
	background: url('http://img.mota.ru/upload/wallpapers/2010/05/14/08/01/22099/mota_ru_0051405-2560x1600.jpg');
	background-size: cover;
}

.clearNight{
	background: url('https://i.imgur.com/Im7TJFZ.jpg');
		background-size: cover;
}

.blackText {
	color: black;
}

/* end switch classes */

h1 {
  color: white;
  font-size: 72px;
  text-shadow: 2px 2px black;
}

h2{
  color: white;
}

p {
  color:white;
}


#temp {
	color:white;
	
}


#foot a{
	text-decoration: none;
	color: white;
}

#foot a:hover{

}

#toggle_ForC{
	color: red;
}

#toggle_ForC:hover{
	color: blue;
	cursor: pointer;
}

#me:hover{
	color: red;
}

            
          
!

JS

            
              $(document).ready(function() {
	var fahrenheit;
	var celcius;
	var locationUrl = "https://freegeoip.net/json/";

	//the pullLocation function pulls the users lat and long.
	function pull() {
		$.ajax({
			dataType: "jsonp",
			url: locationUrl,
			success: function(response) {
				//posts the location to the screen.
				$("#location").text(response.city);
				//stores lat and long for use in weather api.
				var latitude = response.latitude;
				var longitude = response.longitude;
				//console.log(response.latitude);
				//console.log(response.longitude);

		$.ajax({
			dataType: "jsonp",
			url: "https://api.darksky.net/forecast/35f9681ac35ffe962c972d6085ed334e/" +
		latitude +
		"," +
		longitude +
		"?callback=?&units=us",
			success: function(response) {
				//displays temperature and weather
				$("#temperature").text(Math.round(response.currently.temperature));
				$("#weather").text(response.currently.summary);
				//Converts Fahrenheit to Celcius
				celcius = Math.round((response.currently.temperature - 32) * 5 / 9);
				fahrenheit = Math.round(response.currently.temperature);
				var conditions = response.currently.icon;
				//dynamic icon based on weather
				switch (conditions) {
					case "partly-cloudy-day":
						$(icon_changer).toggleClass("wi wi-day-cloudy");
						$('body').addClass('partlyCloudy');
						break;
					case "partly-cloudy-night":
						$(icon_changer).toggleClass("wi wi-night-cloudy");
						$('body').addClass('partlyCloudyNight');
						break;
					case "cloudy":
						$(icon_changer).toggleClass("wi wi-cloudy");
						$('body').addClass('cloudy');
						break;
					case "rain":
						$(icon_changer).toggleClass("wi wi-day-rain");
						$('body').addClass('rain');
						break;
					case "fog":
						$(icon_changer).toggleClass("wi wi-day-fog");
						$('body').addClass('fog');
						break;
					case "wind":
						$(icon_changer).toggleClass("wi wi-day-windy");
						$('body').addClass('wind');
						$('#location').addClass('blackText');
						$('#temperature').addClass('blackText');
						$('#weather').addClass('blackText');
						$('h2').addClass('blackText');
						break;
					case "snow":
						$(icon_changer).toggleClass("wi wi-day-snow");
						$('body').addClass('snow');
						break;
					case "sleet":
						$(icon_changer).toggleClass("wi wi-day-sleet-storm");
						$('body').addClass('sleet');
						$('#location').addClass('blackText');
						$('#temperature').addClass('blackText');
						$('#weather').addClass('blackText');
						$('h2').addClass('blackText');
						break;
					case "clear-day":
						$(icon_changer).toggleClass("wi wi-day-sunny");
						$('body').addClass('clearDay');
						$('#temperature').addClass('blackText');
						break;
					case "clear-night":
						$(icon_changer).toggleClass("wi wi-night-clear");
						$('body').addClass('clearNight');
						break;
					default:
						$(icon_changer).toggleClass("wi wi-day-sunny");
						break;
				}
			}
		});
	}
		});
	}

	//ints the weather & location functions.
	pull();

	//Toggles Fahrenheit to Celcius and changes the letter.
	$("#toggle_ForC").click(function() {
		if ($(toggle_ForC).text() === "F") {
			$(toggle_ForC).text("C");
			$(temperature).text(celcius);
		} else {
			$(toggle_ForC).text("F");
			$(temperature).text(fahrenheit);
		}
	});
});

            
          
!
999px

Console