css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

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.

              <div class="container">
  <div class="row">
    <header class="col-xs-12 text-center">
        <h1>Local Weather App</h1>
    <div class="col-xs-8 col-xs-offset-2">
      <div class="text-center status">
        <p id="location" class="text-center"></p>
        <p id="weather" class="text-center">
          <span id="temp"></span> &#176;<span id="unit">C</span>
        <p class="text-center"><button id="convertTemp" class="btn btn-default btn-primary">Change Temperature Metric</button>
        <p id="icon" class="text-center"></p>
        <p id="summary" class="text-center"></p>

<!-- Footer -->
        <footer id="contact" class=" navbar-fixed-bottom container-fluid">
          <p class="text-center">Gaurav Shah</p>
            <div class="row">
                <div class="col-md-4 col-md-offset-4" >
                    <ul class="list-inline social-buttons">
                        <li><a href="https://www.linkedin.com/in/gauravshahtamu" target="_blank"><i class="fa fa-linkedin"></i></a>
                        <li><a href="https://github.com/gauravshah786" target="_blank"><i class="fa fa-github"></i></a>
                      <li><a href="https://freecodecamp.com/gauravshah786" target="_blank"><i class="fa fa-fire"></i></a>
          <span id="credits">Powered by APIs : <a href="https://darksky.net/poweredby/">Dark Sky </a> & Google Reverse Geocoding</span>
              header {
  margin-bottom: 30px;
.status p {
  font-size: 1.8em;
  text-transform: capitalize;
h1 {
  font-size: 3em;

/* Footer */
footer {
    padding: 25px 0;
    text-align: center;
    background-color: #333;
    color: white;
.social-btns {
    position: absolute;
    top: 70%;
    left: 15%;
    font-size: 24px;
    padding: 10px;
.social-btns a {
    color: #fff;
    padding: 10px;
    -webkit-transition: all 0.3s;
    -moz-transition: all 0.3s;
    transition: all 0.3s;

ul.social-buttons {
    margin-bottom: 10;
ul.social-buttons li a {
    display: block;
    height: 40px;
    width: 40px;
    border-radius: 100%;
    font-size: 24px;
    line-height: 40px;
    color: white;
    outline: none;
    -webkit-transition: all 0.3s;
    -moz-transition: all 0.3s;
    transition: all 0.3s;
ul.social-buttons li a:hover,
ul.social-buttons li a:focus,
ul.social-buttons li a:active {
    background-color: #41C4AB;


function getWeather(){
  //Getting current location's co-ordinates
  if (navigator.geolocation){
      var lat = position.coords.latitude;
      var long = position.coords.longitude;

      var darkSkyKey = "7c476095177ea70a6bf4d90baa398bb1";
      var corsURL = "https://cors-anywhere.herokuapp.com/"; // to avoid Access-Control-Allow-Origin (ACAO) 
      var darkSkyURL = "https://api.darksky.net/forecast/"; //Weather Forecast API URL
      var optionalParam = "?units=si";
      var weatherURL = corsURL + darkSkyURL + darkSkyKey+ "/"+ lat + "," + long + optionalParam;

      //get Weather JSON data 
      $.getJSON(weatherURL, showWeatherDetails);

      var fahrenheitTemp;
      var celsiusTemp;
      var showFahrenheit = false;

      //display Weather Data
      function showWeatherDetails(weatherJSON) {
        var weatherData = weatherJSON.currently;
        var temperature = parseInt(weatherData["temperature"]);
        fahrenheitTemp = Math.round(temperature);
        celsiusTemp = Math.round((temperature * 1.8) + 32);
        var icon = weatherData["icon"];
        var time = weatherData["time"];
        var summary = weatherData["summary"];
        $('#icon').html("<i class='wi wi-forecast-io-" + icon + "'></i>");
      // get Location from lat and long
      var googleKey = "AIzaSyDT5C67yEp1K0Ccn9mFv0eT3OLoghcyodM";
      var googleURL = "https://maps.googleapis.com/maps/api/geocode/json?latlng="; 
      var reverseGeocodingURL = googleURL + lat + "," + long + "&key=" + googleKey;
      $.getJSON(reverseGeocodingURL, function (reverseLocJSON) {
        var city;
        for (var i = 0; i < reverseLocJSON.results[0].address_components.length; i++) {
          var component = reverseLocJSON.results[0].address_components[i];
          if(component.types[0] == "locality") {
              city = component.long_name;

      //convert between temperature metrics
        showFahrenheit = !showFahrenheit;
        if (showFahrenheit) {
        } else {

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................