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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

            
              <h1>BasakEsin Weather App</h1>
<div class="wheather-icon"></div>
<img id = "wheather-icon">
<div id = "location"></div> 
<div id ="Temperature"><p><b>Temperature</b></p></div>
<button id="convertButton" class="btn btn-info" style="font-size:3em"> <div id="btn_text"></div></button>
<p>
  To convert Fahrenheit/Celcius please push the button</p>
<div id="footer">by <a href="http://gunluk.basakesin.net"><b>basakesin</b></a></div>
            
          
!
            
              body{
  background-color: #fcf7f7;
  text-align:center;
}
h1{
  text-align: center;
  font-size: 5em;
  
}
#Temperature{
  text-color: blue;
  font-size: 3em;
  
}
img{
  padding: 3em 5em 4em 6em;
  heigth: 100px;
  width: 200px;
}
#location{
  font-size: 3em;
}
#footer{
  font-size: 1.5em;
}
            
          
!
            
                $(document).ready(function(){
  var flag = 0;
  var btnText = '°C';

  $.getJSON("//freegeoip.net/json/?callback=?", function(json) {
var qurl= "https://fcc-weather-api.glitch.me/api/current?lat=" + json.latitude + "&lon=" + json.longitude;
    var loc = json.region_name;
    var country = json.country_code;
      $("#location").html(loc+', '+country);
    $.getJSON(qurl, function(data){
      var weather_main = data.weather.main;
      var temp = data.main.temp;
      $("#btn_text").html(temp+btnText);
      $("#wheather-icon").attr("src", data.weather[0].icon);
      var temp_f = temp*1.8+32;
 
      $("#convertButton").on("click", function() {
        if(flag==0){
          flag = 1;
          btnText = '°F';
          $("#btn_text").html(temp_f+btnText);
        }
          else{
            flag = 0;
            btnText = '°C';
            $("#btn_text").html(temp+btnText);
          }
      });
      
     
    });
    
  });
  
  });

            
          
!
999px
Loading ..................

Console