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.

            
              <!--
This page is a WIP
5 Day forecast is incomplete
-->
<div id="footer" class="centered">
  <h4>Designed and Developed by Yusuf Adeyemo</h4>
  <h4>Weather Icons by <a href="https://codepen.io/joshbader/pen/EjXgqr">Josh Bader</a></h4>
</div>

<div id="back" class="centered"></div>
<div id="content" class="centered">
  <div class="header">
    <div class="brand">Yusadolat Weather App</div>
    <div class="menu-icon">≡</div>
  </div>
  <div id="mobile-dropdown" style="display: none;">
    <a id="loc-btn">New Location</a>
    <a id="cur-btn">Current Forecast</a>
    <a id="week-btn">Weekly Forecast</a>
  </div>
  <div id="start">
    <div class="start-menu centered middle">
      <div id="zipcode">
        <h3>Enter Zipcode:</h3>
        <input type="text" class="textbox" id="zipbox"></input>
        <button class="btn btn-main btn-icon btn-start" id="zipbutton"><i class="fa fa-arrow-circle-right" aria-hidden="true"></i></button>
      </div>
      <h3 id="or">- OR -</h3>
      <button class="btn btn-main btn-wide btn-start" id="locbutton">Use my IP</button>
    </div>    
  </div>

  <div id="today" class="hidden-top">
    <h3>Today's Forecast</h3>
    <h4>Could not find your location.</h4>
    <div class="weather-icon">
      <div class="icon sun-shower hidden">
        <div class="cloud"></div>
        <div class="sun">
          <div class="rays"></div>
        </div>
        <div class="rain"></div>
      </div>
      <div class="icon thunder-storm hidden">
        <div class="cloud"></div>
        <div class="lightning">
          <div class="bolt"></div>
          <div class="bolt"></div>
        </div>
      </div>
      <div class="icon cloudy hidden">
        <div class="cloud"></div>
        <div class="cloud"></div>
      </div>
    </div>
    <div class="icon flurries hidden">
      <div class="cloud"></div>
      <div class="snow">
        <div class="flake"></div>
        <div class="flake"></div>
      </div>
    </div>
    <div class="icon sunny hidden">
      <div class="sun">
        <div class="rays"></div>
      </div>
    </div>
    <div class="icon rainy hidden">
      <div class="cloud"></div>
      <div class="rain"></div>
    </div>
    <div id="temp" class="centered">
      <h5 id="faren"></h4>
      <span class="spacer"></span>
      <h5 id="celsius"></h4>
    </div>    
  </div>

<div id="week" class="hidden-top">
  <h3>5 Day Forecast</h3>
  <h4>I'll finish this part later :/</h4>
  <div class="day">
    <div class="weather-icon">
      <div class="icon sun-shower hidden">
      <div class="cloud"></div>
      <div class="sun">
        <div class="rays"></div>
      </div>
      <div class="rain"></div>
    </div>
      <div class="icon thunder-storm hidden">
      <div class="cloud"></div>
      <div class="lightning">
        <div class="bolt"></div>
        <div class="bolt"></div>
      </div>
    </div>
      <div class="icon cloudy hidden">
      <div class="cloud"></div>
      <div class="cloud"></div>
    </div>
      <div class="icon flurries hidden">
      <div class="cloud"></div>
      <div class="snow">
        <div class="flake"></div>
        <div class="flake"></div>
      </div>
    </div>
      <div class="icon sunny hidden">
      <div class="sun">
        <div class="rays"></div>
      </div>
    </div>
      <div class="icon rainy hidden">
        <div class="cloud"></div>
        <div class="rain"></div>
      </div>
      <div id="temp" class="centered">
      <h5 id="faren">85° F</h4>
      <span class="spacer"></span>
      <h5 id="celsius"> 30° C</h4>
    </div>
    </div>
  </div>
  <div class="day">
    <div class="weather-icon">
      <div class="icon sun-shower hidden">
      <div class="cloud"></div>
      <div class="sun">
        <div class="rays"></div>
      </div>
      <div class="rain"></div>
    </div>
      <div class="icon thunder-storm hidden">
      <div class="cloud"></div>
      <div class="lightning">
        <div class="bolt"></div>
        <div class="bolt"></div>
      </div>
    </div>
      <div class="icon cloudy hidden">
      <div class="cloud"></div>
      <div class="cloud"></div>
    </div>
      <div class="icon flurries hidden">
      <div class="cloud"></div>
      <div class="snow">
        <div class="flake"></div>
        <div class="flake"></div>
      </div>
    </div>
      <div class="icon sunny hidden">
      <div class="sun">
        <div class="rays"></div>
      </div>
    </div>
      <div class="icon rainy hidden">
        <div class="cloud"></div>
        <div class="rain"></div>
      </div>
      <div id="temp" class="centered">
      <h5 id="faren">85° F</h4>
      <span class="spacer"></span>
      <h5 id="celsius"> 30° C</h4>
    </div>
    </div>
  </div>
  <div class="day">
    <div class="weather-icon">
      <div class="icon sun-shower hidden">
      <div class="cloud"></div>
      <div class="sun">
        <div class="rays"></div>
      </div>
      <div class="rain"></div>
    </div>
      <div class="icon thunder-storm hidden">
      <div class="cloud"></div>
      <div class="lightning">
        <div class="bolt"></div>
        <div class="bolt"></div>
      </div>
    </div>
      <div class="icon cloudy hidden">
      <div class="cloud"></div>
      <div class="cloud"></div>
    </div>
      <div class="icon flurries hidden">
      <div class="cloud"></div>
      <div class="snow">
        <div class="flake"></div>
        <div class="flake"></div>
      </div>
    </div>
      <div class="icon sunny hidden">
      <div class="sun">
        <div class="rays"></div>
      </div>
    </div>
      <div class="icon rainy hidden">
        <div class="cloud"></div>
        <div class="rain"></div>
      </div>
      <div id="temp" class="centered">
      <h5 id="faren">85° F</h4>
      <span class="spacer"></span>
      <h5 id="celsius"> 30° C</h4>
    </div>
    </div>
  </div>
  <div class="day">
    <div class="weather-icon">
      <div class="icon sun-shower hidden">
      <div class="cloud"></div>
      <div class="sun">
        <div class="rays"></div>
      </div>
      <div class="rain"></div>
    </div>
      <div class="icon thunder-storm hidden">
      <div class="cloud"></div>
      <div class="lightning">
        <div class="bolt"></div>
        <div class="bolt"></div>
      </div>
    </div>
      <div class="icon cloudy hidden">
      <div class="cloud"></div>
      <div class="cloud"></div>
    </div>
      <div class="icon flurries hidden">
      <div class="cloud"></div>
      <div class="snow">
        <div class="flake"></div>
        <div class="flake"></div>
      </div>
    </div>
      <div class="icon sunny hidden">
      <div class="sun">
        <div class="rays"></div>
      </div>
    </div>
      <div class="icon rainy hidden">
        <div class="cloud"></div>
        <div class="rain"></div>
      </div>
      <div id="temp" class="centered">
      <h5 id="faren">85° F</h4>
      <span class="spacer"></span>
      <h5 id="celsius"> 30° C</h4>
    </div>
    </div>
  </div>
  <div class="day">
    <div class="weather-icon">
      <div class="icon sun-shower hidden">
      <div class="cloud"></div>
      <div class="sun">
        <div class="rays"></div>
      </div>
      <div class="rain"></div>
    </div>
      <div class="icon thunder-storm hidden">
      <div class="cloud"></div>
      <div class="lightning">
        <div class="bolt"></div>
        <div class="bolt"></div>
      </div>
    </div>
      <div class="icon cloudy hidden">
      <div class="cloud"></div>
      <div class="cloud"></div>
    </div>
      <div class="icon flurries hidden">
      <div class="cloud"></div>
      <div class="snow">
        <div class="flake"></div>
        <div class="flake"></div>
      </div>
    </div>
      <div class="icon sunny hidden">
      <div class="sun">
        <div class="rays"></div>
      </div>
    </div>
      <div class="icon rainy hidden">
        <div class="cloud"></div>
        <div class="rain"></div>
      </div>
      <div id="temp" class="centered">
      <h5 id="faren">85° F</h4>
      <span class="spacer"></span>
      <h5 id="celsius"> 30° C</h4>
    </div>
    </div>
  </div>
</div>
            
          
!
            
              * {
  text-align: center;
  font-family: Verdana;
}

h3 {
  font-size: 30px;
  font-family: Verdana;
}

body {
  background-image: url('https://dl.dropbox.com/s/2av6ep10scjw3rz/XMdF7yz.jpg?dl=0');
}

#back {
  width: 399px;
  height: 749px;
  background-image: url('https://dl.dropbox.com/s/sutc9623jlfyq0t/iPhoneBorderWithShadow.png?dl=0');
  background-repeat: no-repeat;
}

.middle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  -webkit-transform: translateY(-50%);
}

.centered {
  left: 0;
  right: 0;
  margin: 0 auto;
}

#or {
  margin-top: 30px!important;
  margin-left: 0px!important;
  margin-bottom: 30px!important;
  text-align: center!important;
}

#back {
  margin-top: 50px;
  width: 399px;
  height: 749px;
  background-image: url('https://dl.dropbox.com/s/sutc9623jlfyq0t/iPhoneBorderWithShadow.png?dl=0');
  background-repeat: no-repeat;
}

#content {
  position: absolute;
  top: 185px;
  width: 320px;
  height: 479px;
  background-color: #343436;
  overflow: hidden;
}

.hidden-top {
  top: -550px!important;
}

#week {
  position: absolute;
  top: 60px;
  transition: top 500ms;
  height: 419px!important;
  height: 100%;
  width: 100%;
  background-color: #343436;
}

#week h3 {
  color: white;
  font-size: 20px;
}

#week h4 {
  color: white;
  font-size: 16px;
  position: relative;
  margin-top: 15px;
}

#week #temp {
  display: inline-block;
  position: relative;
}

#week .spacer {
  margin-left: 5px;
  margin-right: 5px;
}

#start {
  z-index: 10;
  top: 0px;
  transition: top 500ms;
  position: relative;
  height: 100%;
  width: 100%;
  -moz-transition: top 500ms;
  -webkit-transition: top 500ms;
  -o-transition: top 500ms;
  background-color: #1e1e1e;
}

#zipcode {
  width: 200px;
  margin-left: auto;
  margin-right: auto;
}

.start-menu h3 {
  margin-bottom: 5px;
  text-align: left;
  color: white;
  font-size: 20px;
}

.textbox {
  text-align: left;
  color: black;
  margin-left: -15px;
  font-size: 20px;
  width: 70%;
  border-radius: 5px;
  display: inline-block;
}

.btn-main {
  background-color: #0cf;
  color: black;
}

.btn-main:hover {
  background-color: #28b6da;
  color: black;
}

.btn-wide {
  width: 200px;
}

.btn-icon {
  padding-left: 10px;
  padding-right: 10px;
  padding-top: 2px;
  padding-bottom: 2px;
  display: inline-block;
  font-size: 20px;
  margin-top: -7px;
}

#footer {
  color: #777;
  position: absolute;
  bottom: 10px;
}
#footer * {
  color: #777;
  font-size: 12px;
}

.menu-icon {
  position: absolute;
  top: 0px;
  right: -30px;
  transition: right 500ms;
  transition-delay: 500ms;
  color: #0cf;
  font-size: 40px;
  cursor: pointer;
}

.brand {
  position: absolute;
  top: 10px;
  left: 10px;
  color: #0cf;
  font-size: 25px;
  font-family: 'Open Sans', sans-serif;
  font-weight: bold;
  font-style: italic;
}

.header {
  overflow: hidden;
  position: absolute;
  z-index: 100;
  width: 320px;
  ;
  height: 60px;
  border-bottom: 1px solid #333;
  background-color: #1e1e1e;
}

#mobile-dropdown {
  z-index: 100;
  position: absolute;
  top: 59px;
  right: 20px;
  background-color: #1e1e1e;
  min-width: 140px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1)!important;
}

#mobile-dropdown a {
  color: #0cf;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  text-align: left;
  cursor: pointer;
}

#today {
  position: absolute;
  top: 60px;
  height: 419px!important;
  height: 100%;
  width: 100%;
  background-color: #343436;
}

#today h3 {
  color: white;
  font-size: 20px;
}

#today h4 {
  color: white;
  font-size: 16px;
  position: relative;
  margin-top: 15px;
}

.spacer {
  position: relative;
  display: inline-block;
  margin-top: 15px;
  margin-left: 10px;
  margin-right: 10px;
}

#temp {
  position: absolute;
  bottom: 20px;
}

#temp h5 {
  color: white;
  font-size: 16px;
  position: relative;
  display: inline-block;
  margin-top: 15px;
}

.hidden {
  display: none;
}

#week .icon {
  font-size: 5px!important;
}

/*Animated Weather Icons CSS Below*/

html {
  box-sizing: border-box;
}

html *,
html *:before,
html *:after {
  box-sizing: inherit;
}

h1 {
  margin-bottom: 1.375em;
  color: #fff;
  font-weight: 100;
  font-size: 2em;
  text-transform: uppercase;
}

p,
a {
  color: rgba(255, 255, 255, 0.3);
  font-size: small;
}

p {
  margin: 1.375rem 0;
}

.icon {
  position: relative;
  display: inline-block;
  width: 12em;
  height: 10em;
  font-size: 21px;
  /* control icon size here */
}

.cloud {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: 3.6875em;
  height: 3.6875em;
  margin: -1.84375em;
  background: currentColor;
  border-radius: 50%;
  box-shadow: -2.1875em 0.6875em 0 -0.6875em, 2.0625em 0.9375em 0 -0.9375em, 0 0 0 0.375em #fff, -2.1875em 0.6875em 0 -0.3125em #fff, 2.0625em 0.9375em 0 -0.5625em #fff;
}

.cloud:after {
  content: '';
  position: absolute;
  bottom: 0;
  left: -0.5em;
  display: block;
  width: 4.5625em;
  height: 1em;
  background: currentColor;
  box-shadow: 0 0.4375em 0 -0.0625em #fff;
}

.cloud:nth-child(2) {
  z-index: 0;
  background: #fff;
  box-shadow: -2.1875em 0.6875em 0 -0.6875em #fff, 2.0625em 0.9375em 0 -0.9375em #fff, 0 0 0 0.375em #fff, -2.1875em 0.6875em 0 -0.3125em #fff, 2.0625em 0.9375em 0 -0.5625em #fff;
  opacity: 0.3;
  transform: scale(0.5) translate(6em, -3em);
  animation: cloud 4s linear infinite;
}

.cloud:nth-child(2):after {
  background: #fff;
}

.sun {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2.5em;
  height: 2.5em;
  margin: -1.25em;
  background: currentColor;
  border-radius: 50%;
  box-shadow: 0 0 0 0.375em #fff;
  animation: spin 12s infinite linear;
}

.rays {
  position: absolute;
  top: -2em;
  left: 50%;
  display: block;
  width: 0.375em;
  height: 1.125em;
  margin-left: -0.1875em;
  background: #fff;
  border-radius: 0.25em;
  box-shadow: 0 5.375em #fff;
}

.rays:before,
.rays:after {
  content: '';
  position: absolute;
  top: 0em;
  left: 0em;
  display: block;
  width: 0.375em;
  height: 1.125em;
  transform: rotate(60deg);
  transform-origin: 50% 3.25em;
  background: #fff;
  border-radius: 0.25em;
  box-shadow: 0 5.375em #fff;
}

.rays:before {
  transform: rotate(120deg);
}

.cloud + .sun {
  margin: -2em 1em;
}

.rain,
.lightning,
.snow {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: 3.75em;
  height: 3.75em;
  margin: 0.375em 0 0 -2em;
  background: currentColor;
}

.rain:after {
  content: '';
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: 1.125em;
  height: 1.125em;
  margin: -1em 0 0 -0.25em;
  background: #0cf;
  border-radius: 100% 0 60% 50% / 60% 0 100% 50%;
  box-shadow: 0.625em 0.875em 0 -0.125em rgba(255, 255, 255, 0.2), -0.875em 1.125em 0 -0.125em rgba(255, 255, 255, 0.2), -1.375em -0.125em 0 rgba(255, 255, 255, 0.2);
  transform: rotate(-28deg);
  animation: rain 3s linear infinite;
}

.bolt {
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -0.25em 0 0 -0.125em;
  color: #fff;
  opacity: 0.3;
  animation: lightning 2s linear infinite;
}

.bolt:nth-child(2) {
  width: 0.5em;
  height: 0.25em;
  margin: -1.75em 0 0 -1.875em;
  transform: translate(2.5em, 2.25em);
  opacity: 0.2;
  animation: lightning 1.5s linear infinite;
}

.bolt:before,
.bolt:after {
  content: '';
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  margin: -1.625em 0 0 -1.0125em;
  border-top: 1.25em solid transparent;
  border-right: 0.75em solid;
  border-bottom: 0.75em solid;
  border-left: 0.5em solid transparent;
  transform: skewX(-10deg);
}

.bolt:after {
  margin: -0.25em 0 0 -0.25em;
  border-top: 0.75em solid;
  border-right: 0.5em solid transparent;
  border-bottom: 1.25em solid transparent;
  border-left: 0.75em solid;
  transform: skewX(-10deg);
}

.bolt:nth-child(2):before {
  margin: -0.75em 0 0 -0.5em;
  border-top: 0.625em solid transparent;
  border-right: 0.375em solid;
  border-bottom: 0.375em solid;
  border-left: 0.25em solid transparent;
}

.bolt:nth-child(2):after {
  margin: -0.125em 0 0 -0.125em;
  border-top: 0.375em solid;
  border-right: 0.25em solid transparent;
  border-bottom: 0.625em solid transparent;
  border-left: 0.375em solid;
}

.flake:before,
.flake:after {
  content: '\2744';
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -1.025em 0 0 -1.0125em;
  color: #fff;
  list-height: 1em;
  opacity: 0.2;
  animation: spin 8s linear infinite reverse;
}

.flake:after {
  margin: 0.125em 0 0 -1em;
  font-size: 1.5em;
  opacity: 0.4;
  animation: spin 14s linear infinite;
}

.flake:nth-child(2):before {
  margin: -0.5em 0 0 0.25em;
  font-size: 1.25em;
  opacity: 0.2;
  animation: spin 10s linear infinite;
}

.flake:nth-child(2):after {
  margin: 0.375em 0 0 0.125em;
  font-size: 2em;
  opacity: 0.4;
  animation: spin 16s linear infinite reverse;
}


/* Animations */

@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

@keyframes cloud {
  0% {
    opacity: 0;
  }
  50% {
    opacity: 0.3;
  }
  100% {
    opacity: 0;
    transform: scale(0.5) translate(-200%, -3em);
  }
}

@keyframes rain {
  0% {
    background: #0cf;
    box-shadow: 0.625em 0.875em 0 -0.125em rgba(255, 255, 255, 0.2), -0.875em 1.125em 0 -0.125em rgba(255, 255, 255, 0.2), -1.375em -0.125em 0 #0cf;
  }
  25% {
    box-shadow: 0.625em 0.875em 0 -0.125em rgba(255, 255, 255, 0.2), -0.875em 1.125em 0 -0.125em #0cf, -1.375em -0.125em 0 rgba(255, 255, 255, 0.2);
  }
  50% {
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0.625em 0.875em 0 -0.125em #0cf, -0.875em 1.125em 0 -0.125em rgba(255, 255, 255, 0.2), -1.375em -0.125em 0 rgba(255, 255, 255, 0.2);
  }
  100% {
    box-shadow: 0.625em 0.875em 0 -0.125em rgba(255, 255, 255, 0.2), -0.875em 1.125em 0 -0.125em rgba(255, 255, 255, 0.2), -1.375em -0.125em 0 #0cf;
  }
}

@keyframes lightning {
  45% {
    color: #fff;
    background: #fff;
    opacity: 0.2;
  }
  50% {
    color: #0cf;
    background: #0cf;
    opacity: 1;
  }
  55% {
    color: #fff;
    background: #fff;
    opacity: 0.2;
  }
}
            
          
!
            
              //https://api.wunderground.com/api/e4124243d93d460c/conditions

$(document).ready(function() {
  $('.menu-icon').click(function() {
    $('#mobile-dropdown').fadeToggle('fast');
  });

  $('#loc-btn').click(function() {
    changeMenu('location');
  });
  $('#cur-btn').click(function() {
    changeMenu('current');
  });
  $('#week-btn').click(function() {
    getWeatherWeek();
  });

  $('#zipbutton').click(function() {
    getWeatherZip();
  });

  //Please not page must be http not https for this to work
  $('#locbutton').click(function() {
    getWeatherLoc();
  });
  
  function resetIcons() {
    $('div.thunder-storm').addClass('hidden');
    $('div.rainy').addClass('hidden');
    $('div.sun-shower').addClass('hidden');
    $('div.flurries').addClass('hidden');
    $('div.cloudy').addClass('hidden');
    $('div.sunny').addClass('hidden');
    $('div.cloudy').addClass('hidden');
  }

  function changeIcon(weatherId) {
    resetIcons();
    
    //change icon
    if (weatherId >= 200 && weatherId <= 232) {
      $('div.thunder-storm').removeClass('hidden');
    } else if (weatherId >= 300 && weatherId <= 321) {
      $('div.rainy').removeClass('hidden');
    } else if (weatherId >= 500 && weatherId <= 531) {
      $('div.sun-shower').removeClass('hidden');
    } else if (weatherId >= 600 && weatherId <= 622) {
      $('div.flurries').removeClass('hidden');
    } else if (weatherId >= 700 && weatherId <= 781) {
      $('div.cloudy').removeClass('hidden');
    } else if (weatherId == 800) {
      $('div.sunny').removeClass('hidden');
    } else if (weatherId > 800) {
      $('div.cloudy').removeClass('hidden');
    }
  }

  function changeTemp(temp) {
    var farenTemp = Math.round(temp * 9 / 5 - 459.67);
    var celsiusTemp = Math.round(temp - 273.15);
    $('#faren').text(farenTemp + "° F");
    $('#celsius').text(celsiusTemp + "° C");
  }

  function changeMenu(menu) {
    $('#mobile-dropdown').fadeOut('fast');
    if (menu === 'current') {
      $('#today').removeClass('hidden-top');
      $('#start').addClass('hidden-top');
      $('#week').addClass('hidden-top');
      $('.menu-icon').css('right', '10px');
    } else if (menu === 'location') {
      $('.menu-icon').css('right', '-30px');
      $('#today').addClass('hidden-top');
      $('#week').addClass('hidden-top');
      $('#start').removeClass('hidden-top');
    } else if (menu === 'week') {
      $('.menu-icon').css('right', '10px');
      $('#today').addClass('hidden-top');
      $('#start').addClass('hidden-top');
      $('#week').removeClass('hidden-top');
    }
  }
  
  function getWeatherZip() {
    var regex = /^\d+$/; //all integers
    if ($('#zipbox').val().match(regex) && $('#zipbox').val().length === 5) {
      //get weather
      var zipcode = $('#zipbox').val();
      var apiKey = "fd99e0cd863cff15807add93a82c79a7";
      var url = "http://api.openweathermap.org/data/2.5/weather";
      $.getJSON(url + '?zip=' + zipcode + ',us' + "&appid=" + apiKey, function(json) {
        //change icon
        var weatherId = json.weather[0].id;
        changeIcon(weatherId);

        //change text of location and temp
        $.getJSON("https://maps.googleapis.com/maps/api/geocode/json?address=" + $('#zipbox').val() + "&sensor=true", function(json) {
          $('#today h4').text(json.results[0].formatted_address);
        });
        var temp = json.main.temp; //unit is kelvin
        changeTemp(temp);  
        changeMenu('current');      
        $('#zipbox').val('');
      });
    } else {
      alert('Invalid 5 Integer Zipcode');
    }
  }
  
  function getWeatherLoc() {
    $.getJSON("http://ip-api.com/json", function(json) {
      var city = json.city;
      var region = json.region;
      var lat = json.lat;
      var lon = json.lon;
      var apiKey = "fd99e0cd863cff15807add93a82c79a7";
      var url = "http://api.openweathermap.org/data/2.5/weather";
      $.getJSON(url + '?lat=' + lat + '&lon=' + lon + "&appid=" + apiKey, function(json) {
        //change icon
        var weatherId = json.weather[0].id;
        changeIcon(weatherId);

        //change text and temp        
        $('#today h4').text(city + ', ' + region);
        var temp = json.main.temp; //unit is kelvin
        changeTemp(temp);
        changeMenu('current');
      });
    });
  }
  
  function getWeatherWeek() {
    changeMenu('week');
  }
});
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console