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.


                <div class="container text-center">

  <div class="page-header">
    <h1>L<i class="fa fa-sun-o" aria-hidden="true"></i>CAL WEATHER</h1>
    <!--show city name and country-->
    <h4> <p id="city"></p></h4>

  <!--Area that displays the data. By default, only row1 (Current Outlook, Min/Max and Humidity) is shown.-->
  <div class="container data">
    <div class="row">

      <div class="col-md-4 subdata">
        <p id="temperature"></p>
      <div class="col-md-4 subdata">
        Min. / Max.
        <p id="min-max"></p>
      <div class="col-md-4 subdata">
        <p id="humidity"></p>

    <!--Row2 contains Wind, Pressure and Visibility data, displayed when user clicks on the "More" button at the bottom of the app-->
    <div class="row collapse" id="moreweather">
      <div class="col-md-4 subdata">
        <p id="wind"></p>
      <div class="col-md-4 subdata">
        <p id="pressure"></p>
      <div class="col-md-4 subdata">
        <p id="visibility"></p>
    <!--options buttons at the bottom of the app-->
    <div class="row text-center optional">
      <button class="btn btn-default" id="celcius">°C</button>
      <button class="btn btn-default" id="fahren">°F</button>
      <button class="btn btn-default btn-toggledata" data-toggle="collapse" data-target="#moreweather">More</button>
      <!--Hiding this button for now!
      <button class="btn btn-default btn-togglecolor"><i class="fa fa-bars" aria-hidden="true"></i></button>-->
      <!--this button allows users to select a color scheme-->
      <div class="btn-group">
        <button class="btn btn-default dropdown-toggle" data-toggle="dropdown" type="button">
    Customize <span class="caret"></span>
        <ul class="dropdown-menu" role="menu">
          <li class="dropdown-header">Colour</li>
          <li><a href="#" id="blues"><i class="fa fa-square" style="color:#373442"></i> <i class="fa fa-square" style="color:#5e5c67
          <li><a href="#" id="warms"><i class="fa fa-square" style="color:#331111"></i> <i class="fa fa-square" style="color:#5b4040"></i></a></li>
          <li><a href="#" id="sunnies"><i class="fa fa-square" style="color:#cc6611"></i> <i class="fa fa-square" style="color:#d68440"></i></a></li>
          <li><a href="#" id="turquoise"><i class="fa fa-square" style="color:#207068"></i> <i class="fa fa-square" style="color:#4c8c86"></i></a></li>



  background-color: #207068; /* dark turquoise - originally I used #6d7993 lavender*/
  color: #fff;

.page-header {
    border-bottom: 0.5px solid rgb(140, 140, 140);

  letter-spacing: 2px;
  opacity: 0.5;

  padding: 20px;
  width: 70%;
  background-color:#4c8c86; /*medium light turquoise - originally I used #96858f dusty purple*/
  border-radius: 20px;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);

  background-color: #207068;

  font-size: 0.9em;
  padding: 4px 7px;
  margin: 4px 0px;

  display: none;

  font-size: 1.5em;

  font-size: 1.8em;

.dropdown-menu {
 min-width: 87px;
 text-align: center;

/*---start of color schemes---*/
  background-color: #8fc33a;

  background-color: #e9c904;

  background-color: #8fc33a;

.page-header2 {
    border-bottom: 0.5px solid #c4bf9b;

/*---end of color schemes---*/


   //determine the user's position (latitude and longitude)
    navigator.geolocation.getCurrentPosition(success, error);

    function success(pos){
     var crd = pos.coords;
     var weatherAPI = "" + crd.latitude + "&lon=" + crd.longitude;
      $.getJSON(weatherAPI, function(result){
         $("#city").html( + ", " + + "<img src=" +[0].icon + ">");//City, country and logo within the header
         $("#humidity").html(result.main.humidity + "%");
         $("#wind").html(result.wind.speed + " km/h");
         $("#pressure").html(result.main.pressure + " mb");
        var visib = Math.round(result.visibility/1000);
         $("#visibility").html(visib + " km");
        var tempC = Math.round(result.main.temp);
        var tempF = Math.round(result.main.temp * 1.8 + 32);
        var mintempC = Math.round(result.main.temp_min);
        var mintempF = Math.round(result.main.temp_min * 1.8 + 32);
        var maxtempC = Math.round(result.main.temp_max);
        var maxtempF = Math.round(result.main.temp_max * 1.8 + 32);
        $("#temperature").html(tempC + "° " +[0].main);//display temp in Celcius by default
        $("#min-max").html(mintempC + "° / " + maxtempC + "°");
        //switch between °F and °C by clicking the buttons
              $("#temperature").html(tempF + "° " +[0].main
              $("#min-max").html(mintempF + "° / " + maxtempF + "°")
              $("#temperature").html(tempC + "° " +[0].main
              $("#min-max").html(mintempC + "° / " + maxtempC + "°")
      }).fail("Sorry, no weather data is currently available");//error handling when the API call is not successful
  //text that appears if app cannot determine location
  function error(err){
  $(".data").html("<h2>Sorry, unable to determine your location</h2>");
  //color scheme toggle option
  //blues colors scheme
    $("body").css("background-color", "#373442");
    $(".data").css("background-color", "#5e5c67");
    $(".subdata").css("background-color", "#373442");
   //warms colors scheme
    $("body").css("background-color", "#331111");
    $(".data").css("background-color", "#5b4040");
    $(".subdata").css("background-color", "#331111 ");
  //sunnies colors scheme
    $("body").css("background-color", "#cc6611");
    $(".data").css("background-color", "#d68440");
    $(".subdata").css("background-color", "#cc6611 ");
  //turquoise colors scheme
    $("body").css("background-color", "#207068");
    $(".data").css("background-color", "#4c8c86");
    $(".subdata").css("background-color", "#207068 ");
  //change the toggle button "More" to "Less" and vice versa
  $("#moreweather").on("", function(){
 $("#moreweather").on("", function(){