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.

              <body onload="getLocation()">
<div class="container text-center">
<h2>Free Code Camp Zipline</h2>
<h2>Local Weather App</h2>
<h2><span class="temp-icon"></span> <span class="temp-unit"></span></h2>

<div class='btn-group'>
<button class='btn btn-success ft'>Fahrenheit</button>
<button class='btn btn-success kt'>Kelvin</button>
<button class='btn btn-success ct'>Celcius</button>

<div id="breadcrumbs">
<span class="breadcrumb city"></span> <span class="breadcrumb desc"></span> <span class="breadcrumb wind-speed"></span>
	background: none;
	color: #fff;
	font-size: 24px;
	color: #fff;
	padding: 10px;
	margin: 10px;
	border: 1px solid #d43f3a;
    background-color: #c9302c;
    border-color: #ac2925;
    cursor: pointer;
	margin-top: 50px;
function getLocation() {
    if (navigator.geolocation) {
        let geo = navigator.geolocation.getCurrentPosition(showPosition);
      if (typeof geo === "undefined") {
        /** Fallback if geolocation don't work **/
        $.getJSON("http://ipinfo.io", function(data){
          data = { name: data.city + " " +  data.country, coords: {
            latitude: data.loc.split(',')[0], longitude: data.loc.split(',')[1]
    } else { 
        alert("Geolocation is not supported by this browser.");

function showPosition(position) {
  /**Geolocation function to show position**/
    var latitude = position.coords.latitude;
    var longitude = position.coords.longitude;
    var direx  = function(deg){/*Direction of ther wind*/
      if(deg >= 0 && deg <=90) return("NE");
      else if(deg > 90 && deg <=180) return("SE");
      else if(deg > 180 && deg <=270) return("SW");
      else if(deg > 270 && deg <=360) return("NW");       

      var city = data.name;
      var temp = data.main.temp;
      var tempCelc = (data.main.temp-273.15).toFixed(2);
      var tempFahren = (data.main.temp*(9/5)-459.7).toFixed(2);
      var wd = data.weather.shift(); //wd {Weather Data}
      var icon = wd.icon;
      var desc = wd.description;
      var speed = data.wind.speed;
      var direction = direx(data.wind.deg);
      $('.temp-icon').html("<img src=http://openweathermap.org/img/w/"+icon+".png>");
      $('.temp-unit').html(tempCelc+" &deg;C");

        $('.temp-unit').html(tempFahren+" &deg;F"); //Changes temperature unit to fahrenheit
        $('.temp-unit').html(temp+" &deg;K"); //Changes temperature unit to Kelvin
        $('.temp-unit').html(tempCelc+" &deg;C"); //Changes temperature unit to Celcius
      $('.city').html(city); //City
      $('.wind-speed').html(direction+" "+speed+" Knots");

      switch(desc){ /*Checks the nature of the weather and changes the background-image*/
       case "broken clouds":
       $('body').css('background','url(http://media.kids-myshot.nationalgeographic.com/2012/11/50b593863c91024122011180_large_medium.jpg) no-repeat');

       case "sky is clear":
       $('body').css('background','url(http://www.artes.unt.edu.ar/wp-content/uploads/2013/01/sunny_day-1920x12002.jpg) no-repeat');

       case "few clouds":
       $('body').css('background','url(https://api.ning.com/files/lEC1MBJNA7ZGgSRmoNZs1lpsgNT4ulGnVu04BnJul-9FG8MHpKKbTZViNwUzP2HjsVXbQa8RzSuDuemTd3PrvGevZjpxgapm/Cirrus1.jpg) no-repeat');

       case "scattered clouds":
       $('body').css('background','url(http://pre12.deviantart.net/f990/th/pre/i/2012/039/b/c/scattered_clouds_by_devilicious_g-d4p174r.jpg) no-repeat');

       case "shower rain":
       $('body').css('background','url(http://icons.wunderground.com/data/wximagenew/a/aerojad/3-800.jpg) no-repeat');

       case "Rain":
       $('body').css('background','url(http://wonderopolis.org/wp-content/uploads/2012/03/rain-clouds_shutterstock_55994950.jpg) no-repeat');

       case "Thunderstorm":
       $('body').css('background','url(http://i.ytimg.com/vi/1h5sDY2e4Rk/maxresdefault.jpg) no-repeat');

       case "snow":
       $('body').css('background','url(http://www.thelistlove.com/wp-content/uploads/2014/12/9.jpg) no-repeat');

       case "mist":
       $('body').css('background','url(http://jameswoodward.files.wordpress.com/2010/05/themist.jpg) no-repeat');

       $('body').css('background','url(http://www.artes.unt.edu.ar/wp-content/uploads/2013/01/sunny_day-1920x12002.jpg) no-repeat');
Loading ..................