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.

            
              <head>
  <link href='//fonts.googleapis.com/css?family=Sofia' rel='stylesheet'>
  <link href="https://fonts.googleapis.com/css?family=Barrio" rel="stylesheet">
<link href='//fonts.googleapis.com/css?family=Almendra Display' rel='stylesheet'>
  <link href='//fonts.googleapis.com/css?family=Caesar Dressing' rel='stylesheet'>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body class="background">
  <div id = "showcase" class = "text-center">
    <h1>Your Weather</h1>
    <h3 id = "c">C °</h3>\<h3 id = "f">F °</h3>
  </div><br>
  <div id = "container" class="text-center">
    <div id = "location">
      <h3>Wait for 5 sec plz~( v ̄▽ ̄)</h3>
    </div><br>
  <div id = "date">
    <h5>TIMEZONE</h5>
  </div>
    <p id = 'icon'>Wait for 5 sec plz~( v ̄▽ ̄)</p>
        <div id='con'>
    <p id = 'maxmin'>MAX: MIN:</p>
    <p id = 'etc'>Humidity: WindSpeed:</p>
    </div>
    <p id = 'dn'>Next 5 days ( v ̄▽ ̄) イエーイ♪</p>
  <div id="5days">
    <p id = "dayO">1</p>
    <p id = "dayT">2</p>
    <p id = "dayThr">3</p>
    <p id = "dayFr">4</p>
    <p id = "dayF">5</p>   
  </div>
    <p id ='last'>Click me to CLose</p>
 </div>
  <center>
<i id ='magic' class="fa fa-cloud fa-5x" aria-hidden="true"></i>
    <br>
    <h1 id = "wnans">Click the icon to Search</h1>
</center>
</body>

            
          
!
            
              #showcase {
  color:white;
}

#container{
  width:35%;
  min-width:450px;
  padding:10px;
  margin:auto;
  background-color:#ffffff;
  opacity:0.6;
  border-style:solid;
  border-radius: 30px;
  border-color:white;
  font-family : Caesar Dressing;
  word-wrap:break-word;
}
.background {
  width:100%;
  height:auto;
  background-image: url('https://www.suyongso.com/files/attach/images/115/733/477/014/65af5577e610da07f455482d8b84cc7e.jpg')
}
#showcase { 
  margin-top:60px;
  margin-bottom : 30px;
  font-family : almendra display;
}
#location {
  font-size : 50px;
}
.large{
  width:150px;
}
#icon {
  font-size:25px;
}
#maxmin {
  font-size:20px;
  margin:0;
}
#etc {
  margin:0;
}
#dn {
  margin-top : 15px;
  margin-bottom:0;
}
#magic:hover {
  color:white;
}
#wnans{
  margin-top:20px;
  font-family:Barrio;
  color:white;
}
#c:hover:active{
  color:tomato;
}
#f:hover:active{
  color:tomato;
}
h3 {
  display:inline;
}
            
          
!
            
              
$(document).ready(function(){
  //Get Geolocation
  var latitude = [];
  var longitude = [];
if (navigator.geolocation) {
  navigator.geolocation.getCurrentPosition(function(position) {
    latitude = position.coords.latitude;
    longitude = position.coords.longitude;
    //Get Location
    var api = 'https://maps.googleapis.com/maps/api/geocode/json?latlng='+latitude+','+longitude+'&sensor=true';
    $.getJSON(api,function(data){
      //Location & Zone
     var loc = data.results[0].address_components[0].long_name + ',' +data.results[0].address_components[3].long_name + ',' +data.results[0].address_components[7].long_name;
      var zone = data.results[0].address_components[6].short_name + ',' + data.results[0].address_components[5].long_name;
      //Display location & TimeZone
      $("#location").html(loc);
      $("#date").html(zone);
      //Get Woeid
      var getWoeid = 'https://crossorigin.me/https://www.metaweather.com/api/location/search/?lattlong=' + latitude + ',' + longitude;
      $.getJSON(getWoeid,function(woeid){
        var numWoeid = woeid[0].woeid ;   
        //Get Weather
        var weatherApi = 'https://crossorigin.me/https://www.metaweather.com/api/location/' + numWoeid + '/';
        $.getJSON(weatherApi,function(wea){
          //icon
          var ic = 'https://www.metaweather.com/static/img/weather/ico/'+wea.consolidated_weather[0].weather_state_abbr+'.'+'ico';
          //Current Weather
          var theTem = Math.floor(wea.consolidated_weather[0].the_temp);
          var theMax = Math.floor(wea.consolidated_weather[0].max_temp);
          var theMin = Math.floor(wea.consolidated_weather[0].min_temp);
          var condition = 'Humidity: '+wea.consolidated_weather[0].humidity +' WindSpeed: ' + Math.floor(wea.consolidated_weather[0].wind_speed);
          var current = "<img class='large' src='"+ic+"'"+"'>" + '<br>' + theTem + ' C °';
          var maxMin = 'Max: ' + theMax +' C °' + ' Min: ' + theMin + ' C °';
          $("#icon").html(current);
          $("#maxmin").html(maxMin);
          $("#etc").html(condition);
   //Weather For Next FIve days
   var fiveDays = [];
   var eachDay = new Array([]);
   var fiveIco = [];
   var eachIco = new Array([]);
   var fiveDate = [];
   var eachDate = new Array([]);
    for(var i = 1; i < 6 ; i++) {
    fiveDays = 'Max: ' + Math.floor(wea.consolidated_weather[i].max_temp) + ' C °'+' Min: ' + Math.floor(wea.consolidated_weather[i].min_temp)+ ' C °';
    fiveIco = 'https://www.metaweather.com/static/img/weather/ico/'+wea.consolidated_weather[i].weather_state_abbr+'.'+'ico';
      eachDay[i] = fiveDays;
      eachIco[i] = fiveIco;
      fiveDate = wea.consolidated_weather[i].applicable_date;
      eachDate[i] = fiveDate;
   }
   $("#dayO").html(eachDay[1] + '<br>' + "<img src='"+eachIco[1]+"'"+"'>" + '<br>' + eachDate[1]);
          $("#dayT").html(eachDay[2] + '<br>' + "<img src='"+eachIco[2]+"'"+"'>" + '<br>' + eachDate[2]);
          $("#dayThr").html(eachDay[3] + '<br>' + "<img src='"+eachIco[3]+"'"+"'>" + '<br>' + eachDate[3]);
          $("#dayFr").html(eachDay[4] + '<br>' + "<img src='"+eachIco[4]+"'"+"'>" + '<br>' + eachDate[4]);
          $("#dayF").html(eachDay[5] + '<br>' + "<img src='"+eachIco[5]+"'"+"'>" + '<br>' + eachDate[5]);
          $("#date").html(zone + '<br>' + wea.consolidated_weather[0].applicable_date);
          
    //ConverTo F
  $("#f").on('click',function(){
    var theFah = Math.floor(theTem * 1.8 + 32);
    var maxFah = Math.floor(theMax * 1.8 + 32);
    var minFah = Math.floor(theMin * 1.8 + 32);
    var currentFah = "<img class='large' src='"+ic+"'"+"'>" + '<br>' + theFah + ' F °';
          var maxMinFah = 'Max: ' + maxFah +' F °' + ' Min: ' + minFah + ' F °';
    $("#icon").html(currentFah);
    $("#maxmin").html(maxMinFah);
    
       var fiveDaysFah = [];
   var eachDayFah = new Array([]);
   var fiveIcoFah = [];
   var eachIcoFah = new Array([]);
   var fiveDateFah = [];
   var eachDateFah = new Array([]);
    for(var i = 1; i < 6 ; i++) {
      var maf = Math.floor(wea.consolidated_weather[i].max_temp);
      var maff = Math.floor(maf * 1.8 + 32);
      
      var mif = Math.floor(wea.consolidated_weather[i].min_temp);
      var miff = Math.floor(mif * 1.8 + 32);
    fiveDaysFah = 'Max: ' + maff + ' F °'+' Min: ' + miff + ' F °';
    fiveIcoFah = 'https://www.metaweather.com/static/img/weather/ico/'+wea.consolidated_weather[i].weather_state_abbr+'.'+'ico';
      eachDayFah[i] = fiveDaysFah;
      eachIcoFah[i] = fiveIcoFah;
      fiveDateFah = wea.consolidated_weather[i].applicable_date;
      eachDateFah[i] = fiveDateFah;
   }
   $("#dayO").html(eachDayFah[1] + '<br>' + "<img src='"+eachIcoFah[1]+"'"+"'>" + '<br>' + eachDateFah[1]);
          $("#dayT").html(eachDayFah[2] + '<br>' + "<img src='"+eachIcoFah[2]+"'"+"'>" + '<br>' + eachDateFah[2]);
          $("#dayThr").html(eachDayFah[3] + '<br>' + "<img src='"+eachIcoFah[3]+"'"+"'>" + '<br>' + eachDateFah[3]);
          $("#dayFr").html(eachDayFah[4] + '<br>' + "<img src='"+eachIcoFah[4]+"'"+"'>" + '<br>' + eachDateFah[4]);
          $("#dayF").html(eachDayFah[5] + '<br>' + "<img src='"+eachIcoFah[5]+"'"+"'>" + '<br>' + eachDateFah[5]);
          $("#date").html(zone + '<br>' + wea.consolidated_weather[0].applicable_date);  
    
  });
     //Convert To C
    $("#c").on('click',function(){
          $("#icon").html(current);
          $("#maxmin").html(maxMin);
         $("#dayO").html(eachDay[1] + '<br>' + "<img src='"+eachIco[1]+"'"+"'>" + '<br>' + eachDate[1]);
          $("#dayT").html(eachDay[2] + '<br>' + "<img src='"+eachIco[2]+"'"+"'>" + '<br>' + eachDate[2]);
          $("#dayThr").html(eachDay[3] + '<br>' + "<img src='"+eachIco[3]+"'"+"'>" + '<br>' + eachDate[3]);
          $("#dayFr").html(eachDay[4] + '<br>' + "<img src='"+eachIco[4]+"'"+"'>" + '<br>' + eachDate[4]);
          $("#dayF").html(eachDay[5] + '<br>' + "<img src='"+eachIco[5]+"'"+"'>" + '<br>' + eachDate[5]);
      
      
    })
        })
        
      })
      
    });
  });
  }
  
//Toggle #5days
  $("#5days").hide();
  $("#last").hide();
  $("#dn").on('click',function(){
    $("#5days").slideToggle(1000);
    $("#last").show();
  });
  //FadeIn 
  $("#container").hide();
  $("#magic").on("click",function(){
    $("#container").fadeIn(1000);
    $("#magic , #wnans").remove();
  });
  //last
  $("#last").on('click',function(){
    $("#5days").slideToggle(1000);
    $("#last").fadeOut(800);
  });
 });
            
          
!
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.

Console