Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

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


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <div class="weather-widget">
  <div class="content">
    <div id="location"></div>
    <canvas id="weathericon" class="weather-icon" width="128" height="128"></canvas>
    <div id="temperature" data-units="us"></div>
    <div id="summary"></div>
    <div class="profile-copyright">Built with <img class="profile-heart" alt="❤" src=""> by SeniorKae<br>All rights reserved</div>


  position: fixed;
  width: 400px;
  height: 400px;
  left: 50%;
  top: 50%;

  margin: 0 auto;

  text-align: center;
  font-size: 26px;
  /*color: skyblue;*/

  font-weight: bold;
  font-size: 42px;
  text-align: center;
  color: skyblue;
  cursor: pointer;

  text-align: center;
  /*color: skyblue;*/
  font-size: 23px;

  position: relative;
  top: 50%;
  margin-top: -143px;

  text-align: center;
  margin-top: 30px;
  font-size: 12px;
  color: #222;

  height: 13px;
  width: 13px;


                'use strict';

var getRandomColors = function(luminosity, qty, alpha){
   return randomColor({
     luminosity: luminosity,
     format: 'hsla',
     count: qty,
     alpha: alpha || 0.2

var skycons = new Skycons({
  "resizeClear": true, //android hack
  color: getRandomColors('dark', 1, 1)

var weatherSettings = {
  appid: 'ebcf6cae57e9920b001cdd2ace98d21a',
  resource: '',
  exclude: '?exclude=hourly,daily,flags',
  location: null

var onIpGeolocationSuccess = function(response){
  $('#location').text(  + ', ' + response.region + ', ' +;
  weatherSettings.location = response.loc;

var onIpGeolocationFailure = function(){
  alert('Opps! something went wrong when trying to retrieve your location based on your IP address, please contact seniorkae[at]hotmail[dot]com, if you are using an Ad blocker, please disable it and reload the page =)');

var onForecastSuccess = function(response){
  var unit = $('#temperature').data('units') === 'us' ? 'C': 'F'; //opposite unit representation
  $('#temperature').html(Math.round(response.currently.temperature) + '&deg;' + unit);
  skycons.set($('#weathericon')[0], response.currently.icon);;

var onForecastFailure = function(){
  alert('Opps! something went wrong when trying to retrieve the forecast, please contact seniorkae[at]hotmail[dot]com');

var callForecastAPI = function(){
    var $temperature = $('#temperature');
    var units = $'units');
    $'units', units === 'us' ? 'si' : 'us');
    weatherSettings.units = '&units=' + units;
    $.get(weatherSettings.resource + weatherSettings.appid + '/' + weatherSettings.location + weatherSettings.exclude + weatherSettings.units, 
          onForecastSuccess, 'jsonp')

  //UI dynamic colors
  var colors = getRandomColors('light', 2);
  $('body').css('background', colors[0]);
  $('.weather-widget').css('background', colors[1]);
  //Getting ip geolocation
  var xhr = $.get("", 
                  onIpGeolocationSuccess, 'jsonp')
  //Getting forecast
  //switch between F/C
  $('#temperature').on('click', function(){