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.

            
              <div id="block">

  <h4>Your location is:</h4>
  <div class="along">
  <p id="datacity">city in here</p>,
  <p id="datacountry">country in here</p>,
  <p id="datazip"> zip in here</p>
    </div>
  <h4>The current weather is:</h4>
  <p id="maindesc">weather in here</p>
  <p id="cloudsPercent">weather in here</p>
  <p id="maxtempc" class="c toggletemp">max temp in here</p>
  <p id="maxtempf" class="f toggletemp">max temp in here</p>
  <p id="rain">weather in here</p>
  <p id="mainpressure">weather in here</p>
  <p id="mainhumidity">weather in here</p>
  <img src="https://www.neurobs.com/pres_docs/images/arrow.jpg" class="arrow c sameline" id="winddeg"/>
  <p id="windspeedmph" class="c toggletemp sameline">weather in here</p>
  <img src="https://www.neurobs.com/pres_docs/images/arrow.jpg" class="arrow f sameline"/>
  <p id="windspeedkph" class="f toggletemp sameline">weather in here</p>

<div class="button">
  <button id="converttemp" onclick="getLocation()">Toggle old/new school</button>
</div>

</div>

            
          
!
            
              @import 'https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300';

body {
  background-size: cover;
  color: white;
  text-transform: Uppercase;
  font-family: 'Open Sans Condensed', sans-serif;
  font-size: 3vw;
  margin: 0 auto;
  padding: 0;
  line-height: 1vw;
}

.sameline {
  display: inline;
}

div {
  text-align: center;
}

h4 {
  font-size: 4vw;
  text-align: center;
  color: lightblue;
}

#block {
  background-color: black;
  opacity: 0.7;
  margin-top: 6vh;
  padding-top: 1vh;
  padding-bottom: 1vh;
  width: 50vw;
  margin-left: 25vw;
  border-radius: 1vw;
}

.f {
  display:none;
}

.along p {
  display: inline;
}

button {
  padding: 0.5vw;
  font-size: 1vw;
  border-radius: 0.5vw;
}

.button {
  text-align: center;
  margin-top: 3vh;
  margin-bottom: 3vh;
}

.arrow {
  width: 3vw;
  color: black;
  -ms-transform: rotate(90deg);
  -webkit-transform: rotate(90deg);
  transform: rotate(90deg);
}


            
          
!
            
              $(document).ready(function() {
  

  
  $.getJSON("http://ip-api.com/json", function(ipapi) {
    var city = ipapi.city;
    var country = ipapi.country;
    var zip = ipapi.zip;
    var lon = ipapi.lon;
    var lat = ipapi.lat;
    $('#datacity').text(city);
    $('#datacountry').text(country);
    $('#datazip').text(zip);
    $('#datalon').text(lon);
    $('#datalat').text(lat);
    
    var apikey = "74f8a72e881ab2061cc121506570d753";
    var getWeatherData = "http://api.openweathermap.org/data/2.5/weather?lat=" + lat + "&lon=" + lon + "&appid=" + apikey;
    $.getJSON(getWeatherData, function(getweather) {
      var mainpressure = getweather.main.pressure;
      var mainhumidity = getweather.main.humidity;
      var windspeed = getweather.wind.speed;
      var windspeedmph = Math.round(windspeed * 2.23694);
      var windspeedkph = Math.round(windspeed * 3.6);
      var winddeg = getweather.wind.deg;
   
      var cloudsPercent = getweather.clouds.all;
      var maindesc = getweather.weather[0].description;
      var id = getweather.weather[0].id;
      var maxtemp = getweather.main.temp;
      var weathericon = getweather.weather[0].icon;
      var maxtempc = Math.round(maxtemp - 273.15);
      var maxtempf = Math.round((maxtemp*9/5) - 459.67);
      $('#maindesc').text(maindesc);
      $('#mainpressure').text(mainpressure + ' hPa pressure');
      $('#mainhumidity').text(mainhumidity + '% humidity');
$('#id').text(id);
      $('#windspeed').text(windspeed);
      $('#windspeedmph').text(windspeedmph + ' MPH');
      $('#windspeedkph').text(windspeedkph + ' KPH');
      $('#winddeg').text(winddeg);

    	if (typeof rain == 'number') {

	   $('#rain').text(rain + 'mm of rain in the last 3 hours')

	  } else {

	   $('#rain').hide();

	  }
      
      $('#winddeg').css({
  'transform': 'rotate(' + (winddeg + 90) + 'deg)',
        '-webkit-transform': 'rotate(' + (winddeg + 90) + 'deg)',
        '-moz-transform': 'rotate(' + (winddeg + 90) + 'deg)',
        '-o-transform': 'rotate(' + (winddeg + 90) + 'deg)'
});
      $('#cloudsPercent').text(cloudsPercent + '% cloudcover');
$('#maxtempc').html(maxtempc + "'C");
      $('#maxtempf').html(maxtempf + "'F");
      $("#weathericon").html("<br> <img src = 'http://openweathermap.org/img/w/" + weathericon + ".png'>")
      
      if (id === 802 || id === 801 || id === 951 || id === 952 || id === 953) {
   document.body.style.backgroundImage = "url('https://static.pexels.com/photos/46164/field-of-rapeseeds-oilseed-rape-blutenmeer-yellow-46164.jpeg')";
    } else if (id === 200 || id === 201 || id === 202 || id === 210 || id === 211 || id === 212 || id === 221 || id === 230 || id === 231 || id === 232) {
      document.body.style.backgroundImage = "url('https://static.pexels.com/photos/29095/pexels-photo-29095.jpg')";
    } else if (id === 300 || id === 301 || id === 302 || id === 310 || id === 311 || id === 312 || id === 313 || id === 314 || id === 321) {
      document.body.style.backgroundImage = "url('https://pixabay.com/static/uploads/photo/2016/03/27/16/40/lights-1283073_960_720.jpg')";
    } else if (id === 500) {
      document.body.style.backgroundImage = "url('https://static.pexels.com/photos/68084/pexels-photo-68084-large.jpeg')"
    } else if (id === 501) {
      document.body.style.backgroundImage = "url('https://static.pexels.com/photos/68357/pexels-photo-68357-large.jpeg')"
    } else if (id === 502 || id === 503) {
      document.body.style.backgroundImage = "url('https://static.pexels.com/photos/39811/pexels-photo-39811-large.jpeg')"
    } else if (id === 504 || id === 771) {
      document.body.style.backgroundImage = "url('https://pixabay.com/static/uploads/photo/2012/10/25/14/21/flood-62785_960_720.jpg')"
    } else if (id === 511) {
      document.body.style.backgroundImage = "url('https://pixabay.com/static/uploads/photo/2012/02/24/17/01/frozen-16759_960_720.jpg')"
    } else if (id === 520 || id === 521) {
      document.body.style.backgroundImage = "url('https://pixabay.com/static/uploads/photo/2015/11/07/11/05/rain-1030813_960_720.jpg')"
    } else if (id === 522 || id === 531) {
      document.body.style.backgroundImage = "url('https://pixabay.com/static/uploads/photo/2015/02/19/19/30/storm-642571_960_720.jpg')"
    } else if (id === 600 || id === 620) {
      document.body.style.backgroundImage = "url('https://static.pexels.com/photos/36140/pexels-photo-large.jpg')"
    } else if (id === 601 || id === 621) {
      document.body.style.backgroundImage = "url('https://static.pexels.com/photos/60774/pexels-photo-60774-large.jpeg')"
    } else if (id === 602 || id === 622) {
      document.body.style.backgroundImage = "url('https://pixabay.com/static/uploads/photo/2010/12/13/10/09/blizzard-2396_960_720.jpg')"
    } else if (id === 611 || id === 612) {
      document.body.style.backgroundImage = "url('https://pixabay.com/static/uploads/photo/2015/11/22/18/52/imp-1056741_960_720.jpg')"
    } else if (id === 615 || id === 616) {
      document.body.style.backgroundImage = "url('https://pixabay.com/static/uploads/photo/2013/06/09/20/42/mountain-road-123883_960_720.jpg')"
    } else if (id === 701) {
      document.body.style.backgroundImage = "url('https://static.pexels.com/photos/48694/pexels-photo-48694.jpeg')"
    } else if (id === 702) {
      document.body.style.backgroundImage = "url('https://pixabay.com/static/uploads/photo/2014/09/02/15/28/styggkarret-433688_960_720.jpg')"
    } else if (id === 711) {
      document.body.style.backgroundImage = "url('https://pixabay.com/static/uploads/photo/2014/09/02/15/28/styggkarret-433688_960_720.jpg')"
    } else if (id === 721) {
      document.body.style.backgroundImage = "url('https://static.pexels.com/photos/6720/light-man-red-clouds-large.jpg')"
    } else if (id === 731 || id === 751 || id === 761) {
      document.body.style.backgroundImage = "url('https://pixabay.com/static/uploads/photo/2013/07/19/17/02/sandstorm-165332_960_720.jpg')"
    } else if (id === 741) {
      document.body.style.backgroundImage = "url('https://static.pexels.com/photos/96469/pexels-photo-96469-large.jpeg')"
    } else if (id === 762) {
      document.body.style.backgroundImage = "url('https://pixabay.com/static/uploads/photo/2013/07/18/20/16/mount-st-helens-164848_960_720.jpg')"
    } else if (id === 781 || id === 900) {
      document.body.style.backgroundImage = "url('https://pixabay.com/static/uploads/photo/2015/03/03/17/31/tornado-657633_960_720.jpg')"
    } else if (id === 800) {
      document.body.style.backgroundImage = "url('https://pixabay.com/static/uploads/photo/2012/03/04/00/01/background-21717_960_720.jpg')"
    } else if (id === 803) {      document.body.style.backgroundImage = "url('https://pixabay.com/static/uploads/photo/2015/03/12/14/44/clouds-670301_960_720.jpg')"
    } else if (id === 804) {      document.body.style.backgroundImage = "url('https://pixabay.com/static/uploads/photo/2015/03/26/10/05/power-lines-690893_960_720.jpg')"
    } else if (id === 901 || id === 902 || id === 960 || id === 961 || id === 962) {      document.body.style.backgroundImage = "url('https://pixabay.com/static/uploads/photo/2013/02/25/16/00/key-west-86025_960_720.jpg')"
    } else if (id === 903) {      document.body.style.backgroundImage = "url('https://pixabay.com/static/uploads/photo/2014/08/27/13/00/penguins-429136_960_720.jpg')"
    } else if (id === 904) {      document.body.style.backgroundImage = "url('https://static.pexels.com/photos/71241/pexels-photo-71241-large.jpeg')"
    } else if (id === 905) {      document.body.style.backgroundImage = "url('https://pixabay.com/static/uploads/photo/2015/10/14/16/12/air-bag-987933_960_720.jpg')"
    } else if (id === 906) {      document.body.style.backgroundImage = "url('https://pixabay.com/static/uploads/photo/2014/06/29/09/51/hail-379270_960_720.jpg')"
    } else if (id === 954 || id === 955 || id === 956) {      document.body.style.backgroundImage = "url('https://static.pexels.com/photos/59677/pexels-photo-59677-large.jpeg')"
    } else if (id === 957 || id === 958 || id === 959) {      document.body.style.backgroundImage = "url('https://static.pexels.com/photos/1206/person-woman-girl-blonde-large.jpg')"
    }
      
      
      
      
    });
      
    });
});
  $("#converttemp").on("click", function(){
    $('.toggletemp').toggleClass('f');

    
    
    
});


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

Console