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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

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


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.

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.


                <!--MY LOCAL WEATHER -- LOCATION -- C/F -- IMAGERY -->
<div class = "container-fluid">

<div id = "date"></div>
<div id = "locale"></div>
<div id = "temperature" class = "float-left"></div>
<button class="my-button" id="c-f-toggle"></button>
<div id = "desc"></div>
<div id = "sunrise"></div>
<div id = "sunset"></div>
<div><i id = "icon" class = "wi"></i></div>


                @import url(",500");

body {
  font-family: 'Open Sans Condensed', sans-serif;
  font-size: 24px;
  text-align: left;

.container-fluid div {
  display: block;
  margin-left: 500px;
  margin-right: auto;

.float-left {
  float: left;

.my-button {
  border: none;
  font-family: 'Open Sans Condensed', sans-serif;
  color: #002bff;
  font-size: 24px;
  background: #ffffff;
  padding: 0px 10px 0px 10px;
  text-decoration: none;

.my-button:hover {
  background: #94d6ff;
  text-decoration: none;



//works in firefox, not in chrome

$(document).ready(function() {
  //initial vars
  var userLat;
  var userLon;
  var apiUrlString;
  var isFarenheit = true;
  var unit = "ºF";
  //vars to return from api json keys
  var UNIX_timestamp;
  var userDT;
  var userSunset;
  var userSunrise;
  var jsonWeather;
  var wDescription;
  var tempInC;
  var tempInF;
  var userCity;
  var iconId;
  function getLocation () {
    navigator.geolocation.getCurrentPosition( function(position) {
      userLat = position.coords.latitude;
      userLon = position.coords.longitude;
      doAPIStuff (userLat,userLon);
  }  //getLocation
function doAPIStuff(lat,lon) {
  apiUrlString = ""+lat+"&lon="+lon+"&units=imperial&appid=3b68aa704e7e5a961da6e01ea6dff289";
  $.get(apiUrlString, function(json) {
    jsonWeather = JSON.stringify(json);  //just in case
    userSunset = timeConverter(json.sys.sunset);
    userSunrise = timeConverter(json.sys.sunrise);
    userDT = timeConverter(json.dt);
    userSunset = dateTimeSeparate(userSunset,"time"); 
    userSunrise = dateTimeSeparate(userSunrise,"time");
    wDescription =[0].description;  // "clear sky" 30 Dec 2016 3:15am stands true..  I see a star out the window.
    tempInF = Math.floor(json.main.temp);
    tempInC = Math.floor(json.main.temp-32*0.5556);
    userCity =;
    iconId =[0].id;
    },'jsonp' );
  //jsonWeather = testWeather; ////replace with above 4 lines

function timeConverter(UNIX_timestamp){
  var a = new Date(UNIX_timestamp * 1000);
  var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
  var year = a.getFullYear();
  var month = months[a.getMonth()];
  var date = a.getDate();
  var hour = a.getHours();
  var min = a.getMinutes();
  var ampm = "am";
    if (hour>11 && hour!=24) {
  if (hour>12) {
  //var sec = a.getSeconds();
  var time = date+' '+month+' '+year+' '+hour+':'+min+ampm;
  return time;
}  // time converter
function dateTimeSeparate(date,dayOrTime) {
  var day = date.substring(0,10);
  var time = date.substring(11);
  if (dayOrTime === "day") { return day; } else { return time; }

function toHTML() {
  $("#sunrise").html("Sunrise: " + userSunrise);
  $("#sunset").html("Sunset: " + userSunset);
  $("#c-f-toggle").on("click", function() {
  if (isFarenheit) {
    isFarenheit = false;
    unit = "ºC";
  } else { 
    isFarenheit = true;
    unit = "ºF";
  } //else thing
    }); // click function
    var classId = "wi-owm-"+iconId;
} //to html function

}); //docreadyfunction