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 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

Packages

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.

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.

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.

HTML

              
                <div id="header">
  <div class="right">Build by Carlos Maxwell Varlack</div>
</div>

<div></div>

<div>
  <h1 id="location">Getting location...</h1>
  
  <h2 id="WeatherType">Getting Weather Conditions...</h2>
  
  <h2 id="Farenheit">Getting Temperature(Fahrenheit)...</h2>
  
  <h2 id="High-Low">Getting Temperature(Fahrenheit)...</h2>
  
</div>
              
            
!

CSS

              
                
              
            
!

JS

              
                
$(function(){
  
  var loc;
  var lat;
  var long;
  
  $.getJSON('http://ipinfo.io', function(d){
    
    // split the data into latitude and longitude
    loc = d.loc.split(",");
    //console.log("the assigned data: ", loc);
    
    // set the values of latitude and longitude
    lat = loc[0];
    long = loc[1]
    
    //console.log(loc);
    // get latitude and longitude    
   // console.log("latitude",loc[0]);
    //console.log("longitude",loc[1]);
    
    
    // get the open weather map data
$.getJSON('http://api.openweathermap.org/data/2.5/weather?lat='+loc[0]+'&lon='+loc[1]+'&appid=440289df0175e96571850278c5aa3e66',

         
// Function to get the data for the website.
function(weather){
  //console.log("weather data", weather);
  var Location = weather.name;
 
  var WeatherType = weather.weather[0].description;
  
  // Set the temperature
  var Kelvin = weather.main.temp;
  var KelvinMax = weather.main.temp_max;
  var KelvinMin = weather.main.temp_min;
  var celsius = Kelvin - 273;
  var celsiusMax = KelvinMax - 273;
  var celsiusMin = KelvinMin - 273;
  var fahrenheit = (9.0/5.0)*(celsius) + 32;
 var fahrenheitMax = (9.0/5.0)*(celsiusMax) + 32;
  var fahrenheitMin = (9.0/5.0)*(celsiusMin) + 32;
  var icon = weather.weather[0].icon;
  
  // Passing values to the HTML
  $('#location').html(Location);
  
  $('#Farenheit').html(fahrenheit+' Fahrenheit ');
  $('#High-Low').html('Highs '+fahrenheitMax +' F / Lows '+ fahrenheitMin+' F');
  $('#WeatherType').html(WeatherType);
   
  // variable for icon request
  var iconReq = "http://openweathermap.org/img/w/"+icon+".png" 
  
  // assign Icon Values
  $('#Farenheit').prepend('<img src= "'+iconReq+'" alt= "Weather Icon">');
  
  //console.log("Temperature", Kelvin);
})
    
  })
})

   
 
              
            
!
999px

Console