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 id="bod">




<ul>
  <div id="tstuff">
  
  <li class="a" id="cityName"> </li>
  
  <li class="a" id="cel"> </li>
  
  <li class="a" id="weatherType"> </li>
  
  
  <li class="a" id="windInfo"></li>
  </div>
  
  <button id="but" class="btn btn-default"> Click here to change to Metric/Imperial</button>
  
  
   </ul>
  
  
  
</body>
            
          
!

CSS

            
              body{
  -webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
  
  
 
  font-family:timesnewroman;
}



.a{ text-align:center;
  font-size: 90px;
  
  
  
}
#tstuff {
  background-color: rgba(255, 255, 255, 0.3);

 width: 50%;
  background-color: rgba(255, 255, 255, 0.3);
  margin: 0 auto;
}

            
          
!

JS

            
              $(document).ready(function() {
  //empty vars for use below
  var ftemp;
  var ctemp;
  var long;
  var lat;
  var conversion = true; //this must be a boolean
  // var api = `https://fcc-weather-api.glitch.me/api/current?lat=${coord.lat}&lon=${coord.long}`;
  var coord = {};
  function location() {
    if (navigator.geolocation) {
      navigator.geolocation.getCurrentPosition(function(position) {
        coord.long = position.coords.longitude;
        coord.lat = position.coords.latitude;
        console.log(long, lat);

        $("#data").html(
          "latitude: " + coord.lat + "<br>longitude: " + coord.long
        );

        // var api = `https://fcc-weather-api.glitch.me/api/current?lat=${lat}&lon=${long}`;
        weather();
      });
    }
  }
  function weather() {
    $.getJSON(
      "https://fcc-weather-api.glitch.me/api/current?lat=" +
        coord.lat +
        "&lon=" +
        coord.long,
      function(data) {
        console.log(coord.lat, coord.long);
        // This is the information that I want to display coming from the api
        console.log(data);
        var weatherType = data.weather[0].description;

        var cel = data.main.temp;
        var windInfo = data.wind.speed;
        var cloudInfo = data.clouds.all;
        var cityName = data.name;

        //end of the information still in Json call function here
        //temperature conversions
        ftemp = cel * (9 / 5) + 32;
        ctemp = (ftemp - 32) * (5 / 9);
        //temperature conversions
        // within the same function i will be targting the HTML with jQuery here

        $("#cityName").html(cityName);
        $("#cel").html(cel + "   C°");
        $("#weatherType").html(weatherType);
        $("#windInfo").html(windInfo + "  mph");

        //This will be the button making the conversion from ctemp to ftemp

        $("#but").click(function() {
          if (conversion === true) {
            $("#cel").html(ftemp.toFixed(2) + "   F°");
            conversion = false;
          } else if (conversion === false) {
            $("#cel").html(ctemp.toFixed(2) + "   C°");
            conversion = true;
          }
        });
        //end of the button to convert
        console.log(ctemp);
        if (ctemp <= 0) {
         $("#bod").css("background-image" , "url(https://wallpapers.wallhaven.cc/wallpapers/full/wallhaven-295247.jpg)");
          
        } 
        
        else if (ctemp <= 24) {
          $("#bod").css("background-image", "url(http://aceadventure.com.sg/wp-content/uploads/2015/04/Summit-lake-in-clear-weather.jpg)");
          // $("body").css("backgroundColor", "yellow");
         
        } else {
          $("#bod").css("background-image", "url(https://wallpapers.wallhaven.cc/wallpapers/full/wallhaven-354677.jpg)");
          
        }
      }
    );
  }

  location();
});

//COLD link : https://wallpapers.wallhaven.cc/wallpapers/full/wallhaven-295247.jpg

//MILD link:  https://alpha.wallhaven.cc/wallpaper/478131

//HOT link:  https://alpha.wallhaven.cc/wallpaper/354677

            
          
!
999px

Console