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="row-box">

  <div class="row orange">
    <span>
     OpenWeatherMap app
      </span>
  </div>

  <div class="row red">
    <span>
    <h1></h1>
    <h1 style="display: none"></h1>
      </span>
  </div>


  <div class="row silver">
    <span id="span"></span></div>


  <div class="row coffee">
    <span></span></div>

  <div class="row blue">
    <span></span></div>

  <div class="row navy">
    <span class="space">
  <a href="https://codepen.io/gebrutommy/"> <i class="fa fa-codepen fa-2x"></i></a>
    <a href="https://github.com/tommygebru/"><i class="fa fa-github-alt fa-2x"></i></a>
    <a href="https://twitter.com/gebrutommy/"> <i class="fa fa-twitter fa-2x"></i></a>
    <a href="https://facebook.com"><i class="fa fa-facebook fa-2x"></i></a>
      </span>
  </div><!--navy-->
</div><!--row-box-->
            
          
!
            
              /**********Great weather icons from Erik Flowers**********/

@import "https://cdnjs.cloudflare.com/ajax/libs/weather-icons/2.0.9/css/weather-icons.min.css";

/************************************
             Base Layers
*************************************/

* {
  box-sizing: border-box;
}

.row-box {
  height: 100vh;
  width: 100%;
  background-color: grey;
  display: flex;
  flex-direction: column;
}

.row {
  display: flex;
  flex-direction: column;
  flex: 1;
  border: solid none 1px;
  overflow: hidden;
}

.row:hover {
  display: flex;
  flex: 1.5;
  transition: 1s;
  justify-content: center;
  align-content: center;
}

.row {
  display: flex;
  color: #f2f0ed;
  justify-content: space-around;
  align-content: center;
  font-family: 'Quicksand', sans-serif;
  font-size: 5vw;
}


/************************************
            Rows
*************************************/

.orange {
  background-color: #ff8c00;
}

.silver {
  background-color: #f2f0ed;
}

.silver span {
  color: #3a3133;
}

.red {
  background-color: #ff4000;
}

.coffee {
  background-color: #3a3133;
}

.blue {
  background-color: #3333ff;
}

.navy {
  background-color: #0000b3;
}

.navy a {
  color: white;
}


/************************************
        ``````SPANNING`````` 
*************************************/

span {
  color: #f2f0ed;
  display: flex;
  justify-content: space-around;
  align-content: center;
  font-size: 6.5vw;
  margin: 50px 0px;
}

.silver span, .red span{justify-content:center;  font-size: 7.5vw;}

.silver h1{margin-left:50px;}

.wi {
  color: #3a3133;
 /* font-size: 120%;*/
}

.coffee span,
.blue span,
.navy span {
  font-size: 5vw;
  margin: 50px 0px;
  padding-top: 0px;
}


            
          
!
            
              $(document).ready(function() {
  var api;

  var urlGeo = "http://ip-api.com/json";
  $.getJSON(urlGeo, function(getGeo) {
    console.log("Success with urlGeo: ");
    var lat = getGeo.lat;
    var lon = getGeo.lon;
    var city = getGeo.city;
    var region = getGeo.region;
    var cityRegion = "in " + city + ", " + region;
    api = 'http://api.openweathermap.org/data/2.5/weather?lat=' + lat + '&lon=' + lon + '&appid=52c662f3c521e182bbc01e8ca55a3944';
    console.log("Success with api: " + api);
    $.getJSON(api, function(getData) {

      var description = getData.weather[0].description;
      var descriptionReplace = description.replace(description[0], description[0].toUpperCase());
      var descriptionUpdate = descriptionReplace + " " + cityRegion;
      console.log(descriptionUpdate);
      
      //var icon = getData.weather[0].icon;//trash
      //var iconLink = "http://openweathermap.org/img/w/" + icon + ".png"//trash
      
      var main = getData.weather[0].main;
      var id = getData.weather[0].id;
      var kelvin = getData.main.temp;
      var fahrenheit = Math.round(1.8 * (kelvin - 273) + 32);
      var celsius = Math.round(kelvin - 273);
      console.log("Success with kelvin: " + kelvin);

      var tempf = fahrenheit + " ° F";
      var tempc = celsius + " ° C";
  
      $(".red h1:nth-child(1)").text(tempf);
      $(".red h1:nth-child(2)").text(tempc);

      $(".red span").click(function(){
      $(".red h1").toggle();
      });


      
      $("#span").html("<i class='wi wi-owm-" + id + "'></i><h1>" + main + "</h1>");
      console.log("<i class='wi wi-owm-" + id + "'></i><h1>" + main + "</h1>");
       
      
      
      console.log(id);
      switch (id) {
        case id > 199 && id < 300:
          $(".blue span").html('<h1>"You should grab an umbrella"</h1>');
          break; //good 200  

        case id > 299 && id < 400:
          $(".blue span").html('<h1>"You should grab a jacket"</h1>');
          break; //good 300

        case id > 499 && id < 600:
          $(".blue span").html('<h1>"You should grab an umbrella"</h1>');
          break; //good 500

        case id > 599 && id < 700:
          $(".blue span").html('<h1>"Caution: strange atmosphere today"</h1>');
          break; //good 600

        case id > 799 && id < 900:
          $(".blue span").html('<h1>"Let\'s have some fun in the sun"</h1>');
          break; //good 800

        case id < 909:
          $(".blue span").html('<h1>"Caution: extreme weather today!"</h1>');
          break; //good 900-909//EXTREME

        case id < 957:
          $(".blue span").html('<h1>"Let\'s have some fun in the sun"</h1>');
          break; //good 910-957

        case id > 957:
          $(".blue span").html('<h1>"Caution: extreme weather today!"</h1>');
          break; //good 957 + ^//EXTREME AGAIN

        default:
          $(".blue span").html('<h1>"Have a great day, no matter what!"</h1>');
          //great default
      }

      $(".coffee span").html(descriptionUpdate);

    }); //end Data

  }); //end Geo

}); //end ready
            
          
!
999px
🕑 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 ..................

Console