cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation


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.

              <h1> Local Weather </h1>
	<div id="buttons">
	<button id="celButton">Celsius</button>
	<button id="farButton">Fahrenheit</button>

	<div id="mainDisplay" class="celsius">

		<div id="location">

		<div id="tempDisplay">
		<div id="condition">
		<div id="icon">
		<div id="description">
		<div id="wind">

		<div id="humid">

              $primary-color: #00cccc;
$dark-primary-color: darken($primary-color, 20%);
$secondary-color: #39ac39;
$main-text-color: #404040;

@mixin radial-gradient($from, $to) {
    background: -moz-radial-gradient(center, circle cover, $from 0%, $to 100%);
    background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, $from), color-stop(100%, $to));
    background: -webkit-radial-gradient(center, circle cover, $from 0%, $to 100%);
    background: -o-radial-gradient(center, circle cover, $from 0%, $to 100%);
    background: -ms-radial-gradient(center, circle cover, $from 0%, $to 100%);
    background: radial-gradient(center, circle cover, $from 0%, $to 100%);
    background-color: $from;

	font-family: "Arial";
	@include radial-gradient($primary-color, $secondary-color);
	color: $main-text-color;
	text-align: center;

	margin: 10px;
	button {
		background: $secondary-color;
		color: $main-text-color;
		border: none;
		box-shadow: 10px 5px 5px $dark-primary-color;

#location, #tempDisplay{
	margin: 8px;

#description {
	font-style: italic;
              //get location
function success(pos) {
	  var crd = pos.coords;
	  var lat =crd.latitude;
	  var lon =crd.longitude;
	  console.log('Your current position is:');
	  console.log('Latitude : ' +lat);
	  console.log('Longitude: ' +lon);

	  //Weather API Call
		$.getJSON("http://api.openweathermap.org/data/2.5/weather?lat="+lat+"&lon="+lon+"&appid=e4e1425994f5fa474cdd4b36231633c9", function(data){
	  	//convert tempatures from K and round
	  	var tempC = ((data.main.temp)-273.15).toFixed(1);
	  	var tempF = ((data.main.temp)*(9/5)-459.67).toFixed(1);

	  	//convert windspeed
	  	var windSpeedMetric = data.wind.speed + " m/s";
	  	//need to convert to imperial 
	  	var windSpeedImperial = ((data.wind.speed)*2.2369).toFixed(1) + "mph";

		//Display Conditons (Celsius is default)

		function unitsDisplay(){
				$('#wind').html("<p> Wind Speed: " + windSpeedMetric +"</p>");
				console.log("display in celsius")

				$('#wind').html("<p> Wind Speed: " + windSpeedImperial +"</p>");
					console.log("display in fahrenheit")

			//toogle between imperial and metric 
				$("#mainDisplay").removeClass("celsius fahrenheit").addClass("celsius");
				$("#mainDisplay").removeClass("celsius fahrenheit").addClass("fahrenheit");

		  	$('#location').html(data.name +", "+ data.sys.country);
		  	$('#icon').html("<img src=http://openweathermap.org/img/w/" + data.weather[0].icon+".png>")
		  	$('#humid').html("<p> Humidity: " + data.main.humidity +"% </p>");

	function error(err) {
	  console.warn('ERROR(' + err.code + '): ' + err.message);

navigator.geolocation.getCurrentPosition(success, error);

Loading ..................