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 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.

            
              <body class='layout'>
    <div id="container">
      <svg xmlns="http://www.w3.org/2000/svg" version="1.1" x="0px" y="0px" viewBox="0 0 100 100">
        <path fill-opacity="0" stroke-width="1" stroke="#bbb" d="M81.495,13.923c-11.368-5.261-26.234-0.311-31.489,11.032C44.74,13.612,29.879,8.657,18.511,13.923  C6.402,19.539,0.613,33.883,10.175,50.804c6.792,12.04,18.826,21.111,39.831,37.379c20.993-16.268,33.033-25.344,39.819-37.379  C99.387,33.883,93.598,19.539,81.495,13.923z"/>
        <path id="heart-path" fill-opacity="0" stroke-width="3" stroke="#33ccff" d="M81.495,13.923c-11.368-5.261-26.234-0.311-31.489,11.032C44.74,13.612,29.879,8.657,18.511,13.923  C6.402,19.539,0.613,33.883,10.175,50.804c6.792,12.04,18.826,21.111,39.831,37.379c20.993-16.268,33.033-25.344,39.819-37.379  C99.387,33.883,93.598,19.539,81.495,13.923z"/>
      </svg>
    </div>
    <div class='layout__container'>

      <section class='coffee'>
        <h1 class='coffee__title'>Local Weather - Free Code Camp</h1>
      </section>

      <section class='weather'>
        <p class='weather__city weather__item--val'></p>
        <p class='weather__svg weather__item--val'>
        <img src='' alt='' />
        </p>
        <p class='weather__temp weather__item--val'>
        <cite class='weather__tempCelcius weather__item'> 
        </cite>
        <cite class='weather__tempFarheinheit weather__item'>
        </cite>
        </p>
      </section>
    </div>

    <footer class='footer'>
      <a class='footer__link' href="https://en.wikipedia.org/wiki/Copyleft" target="_blank">
        <img src="https://upload.wikimedia.org/wikipedia/commons/2/29/Cc-sa.svg" alt="copyleft image">
        copyleft
      </a>
      <em>by</em>
      <a class='footer__link' href='https://codepen.io/xavierartot/full/PzBLXW/' target='_blank'>Xavier Artot</a>
    </footer>
  </body>
            
          
!
            
              $color__white: #FFFFFF;
$color__primary--light: #33ccff;
$color__secondary--dark: #252746;
$color__neutral--light: #999999;
$layout__bg-size: cover;
//400 and 700
$text__family-montserrat:  "Montserrat", sans-serif;
//400
$text__family-montserrat-alt:  "Montserrat Alternates", sans-serif;
$layout__max-width: 875px !default;
$layout__padding: 20px, 20px, 20px, 20px !default;
$layout__border-width: 10px !default;
$layout__border-style: solid !default;
$layout__bg-size: 100% !default;
$base__font-size : 1.3em;

@function calc-em($target, $context: $base__font-size) {
  @return ($target / $context) * 1em;
}
// Centre a layout
%layout__block--centered {
  margin-left: auto;
  margin-right: auto;
  display: block;
}
#container {
  @extend %layout__block--centered;
  width: 200px;
  height: 200px;
  max-width: calc-em($layout__max-width);
}
html, body {
  min-height: 100%;
}
body {
    background-size: $layout__bg-size;
    background-color: #252746;
    width: 100%;
    z-index: 0;
    top: 0;
    left: 0;
    color: $color__white;
  * {
    box-sizing: border-box;
  }
}


.layout__container {
  @extend %layout__block--centered;
  max-width: calc-em($layout__max-width);
  padding: calc-em(nth($layout__padding, 1)) calc-em(nth($layout__padding, 2)) calc-em(nth($layout__padding, 3)) calc-em(nth($layout__padding, 4));
  background-color: $color__white;
  border-top: $layout__border-width $layout__border-style $color__primary--light;
}
.coffee {
  .coffee__title {
    color: $color__primary--light; 
    text-align: center;
    font-family: $text__family-montserrat;
    font-weight: 700;
    font-size: 2em;
    border-bottom: solid 1px $color__neutral--light;
    text-transform: uppercase;
  }
}
.weather {
  color: $color__secondary--dark;
  text-align: center;
  font-family: $text__family-montserrat;
  display: flex;
  .weather__item--val {
    display: flex;
    flex-flow: column;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-right: 2em;
    border: 1px solid #999;
    width: 100%;
    font-size: 1.4em;
    flex: 1;
    border-radius: 50%;
    height: 180px;
    width: 180px;
    &:last-child {
      margin-right: 0;
    }
  }
  .weather__city {
  }
  .weather__svg {
  }
  .weather__item {
    cursor: pointer;
  }

}
@media only screen and (max-width: 620px){
  .weather  {
    width: 97%;
    flex-direction: column;
    .weather__item--val  {
      //border-radius: 0;
      //width: 40px;

    justify-content: center;
    align-items: center;
    width: 100%;
      height: 80px;
    border-radius: 0;
    }
    .weather__city {
      -webkit-order: 1;
      -ms-flex-order: 1;
      order: 1;
    }
    .weather__svg {
      -webkit-order: 2;
      -ms-flex-order: 2;
      order: 2;
    }
    .weather__item {
      -webkit-order: 3;
      -ms-flex-order: 3;
      order: 3;
    }
  }
}
footer {
  padding: 30px;
  text-align: center;
  line-height: 1.5;
  font-size: 1em;
  @extend %layout__block--centered;
  max-width: calc-em($layout__max-width);
  padding: calc-em(nth($layout__padding, 1)) calc-em(nth($layout__padding, 2)) calc-em(nth($layout__padding, 3)) calc-em(nth($layout__padding, 4));
  border-top: $layout__border-width $layout__border-style $color__primary--light;
  background-color: $color__white;
  color: $color__neutral--light;
  .footer__link {
    color: $color__neutral--light;
  }
  img  {
    width: 1em;
    height: 1em;
  }
}
            
          
!
            
                    $(document).ready(function() {
        // progressbar.js@1.0.0 version is used
        // Docs: http://progressbarjs.readthedocs.org/en/1.0.0/
        var bar = new ProgressBar.Path('#heart-path', {
          easing: 'easeInOut',
          duration: 1400
        });

        bar.set(0);
        bar.animate(1.0,{
          duration: 3000
        },function () {
          $('#container').fadeOut(800);
        });  // Number from 0.0 to 1.0

        var latitude = '',longitude = '', name='',country='',icon='',main='', description='', tempCelcius='', tempFarheinheit='';
        function success(pos) {
          var crd = pos.coords,latitude, latitude = crd.latitude, longitude = crd.longitude; 
        
          $.getJSON( "http://api.openweathermap.org/data/2.5/weather/?&APPID=067fc5292f804270b643c1e9512c16cd&lon="+longitude+"&lat="+latitude+"&units=metric", function( data ) {
              name            = data.name;
              country         = data.sys.country;
              icon            = 'http://openweathermap.org/img/w/'+data.weather[0]['icon']+'.png';
              main            = data.weather[0]['main'];
              description     = data.weather[0]['description'];
              tempCelcius     = Math.round(data.main.temp);//temp in celcius
              tempFarheinheit = Math.round((tempCelcius*9)/5+32);//convert to Fahreinheit 9/5 + 32
              $('.weather__svg img').attr({
                'src':icon,
                'alt':description 
              });
              $('.weather__city').html(name +', '+ country );
              $('.weather__tempFarheinheit').html(tempFarheinheit+' ºF' );
              $('.weather__tempCelcius').css('display','none').html(tempCelcius +' ºC');
          });

        };
        function error(err) {
          console.warn('ERROR(' + err.code + '): ' + err.message);
        };
        var options = {
          enableHighAccuracy: true,
          timeout: 5000,
          maximumAge: 0
        };
        navigator.geolocation.getCurrentPosition(success, error, options);
        $('.weather__item').on('click', function (e) {
          e.preventDefault();
          $thisItem=$(this);
          $('.weather__item').fadeIn(function(){});
          $thisItem.fadeOut(0);
        });
      });

            
          
!
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