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


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-fluid">
        <nav class="navbar navbar-inverse navbar-fixed-top">
            <div class="container-fluid">
                <div class="navbar-header">
                    <a class="navbar-brand" href="#">Local Weather</a>
                <ul class="nav navbar-nav">
                <ul class="nav navbar-nav navbar-right">
                    <li><a href="#" id='toggle'><span class="cloud"><i class="fa fa-cloud" aria-hidden="true"></i></span> Celsius/Fahrenheit</a></li>
        <div class="spacer"></div>

        <div class="block">
          <div id= "response">
            <h1 class="text-center"><span id="currentTemp">...</span></h1>
            <h1 class="text-center"><span id="currentConditions">...</span></h1><br>
            Country name: <span id="country"></span><br> City: <span id="city"></span><br> Latitude: <span id="latitude"></span><br> Longitude: <span id="longitude"></span><br>

        <div class='spacer'></div>
    <div class="spacer"></div>
  <div  class="footer">
    <div class="container-fluid text-center">
  <div class="footer-text text-muted row"> Copyright &copy; <script>document.write(new Date().getFullYear());</script>  Developed for the FreeCodeCamp Front-end Development Challenges </div>
    <div class="footer-logos row">
      <a href="" target="_blank"><i class="fa fa-linkedin"></i></a>
      <a href="" target="_blank"><i class="fa fa-github"></i></a>
      <a href="" target="_blank"><i class="fa fa-fire"></i></a>
      <a href="" target="_blank"><i class="fa fa-codepen"></i></a>

<!-------footer end ------------------>



                .block {
background-color: #DFF3E3;
opacity: .70;
padding: 20%;
width: 50%;
margin-right: auto;
margin-left: auto;
border-radius: 20px;
padding-bottom: 10px;

	padding: 5%
background:no-repeat center center fixed;
-webkit-background-size: cover;
background-size: cover;



.footer {
  background-color: #000000;
#footer {
  background-color: #000000;
  border-top: 1px solid black;
  bottom: 0;
  font-size: 12px;
  font-weight: normal;
  margin-top: 5em;
  min-width: 320px;
  padding: 1em 1em 0 1em;
  position: absolute;
  width: 100%;

.footer-logos {
  font-size: 14px;
  margin-top: -1em;

.footer-logos a {
  text-decoration: none;

.footer-logos i {
  border: 1px solid rgb(130,14,248);
  border: 1px solid rgb(92,14,250);
  border-radius: 25%;
  color: #4B144C;
  margin: 0 0 1em 1em;
  padding-top: .25em;
  text-align: center;
  vertical-align: -1.5em;

.footer-logos .genericon {
  height: 1.6em;
  width: 1.6em;

.footer-logos .fa {
  height: 1.75em;  
  width: 1.75em;


    var api=""; 
    var apiKey = 'c3a54977f0f3d2c9556b4d1e1bdee268';
  //var lat;
  //var long;
  var C =false; 
  var apiData;
  var data;
  var id;

  function displayTemp(fTemp, c){
    if (c) return Math.round((fTemp-32)*(5/9)) + '&deg; c';
    return Math.round(fTemp) + '&deg; F';
function response(data, C){
              var currentTemp= displayTemp (data.main.temp,C);
              var icon=[0].icon;
              var apiData=data;
              var iconSrc= "" + icon + ".png"; 
              $('#currentTemp').prepend('<img src=' + iconSrc + '>');

$('#submit weather').click(function(){
  var city = $('#city').val();
  if(city != ''){
    url: 'https//' + city + "&units=imperial" + '&type=accurate' + callback + "&APPID=c3a54977f0f3d2c9556b4d1e1bdee268",
        type: 'GET',
        datatype: 'jsonp',
        success: function(data){
          var widget = show(data);

 backgroundImg = [
     .done (function(location)
              $.getJSON(''+location.latitude+'&lon='+location.longitude+'&units=imperial&appid=c3a54977f0f3d2c9556b4d1e1bdee268', function(data){//--->USE HTTPS^


                response (apiData,C);
                    C = !C;
                var id =[0].id,
                backgroundId = [299, 399, 599, 699, 799, 800, 899, 905];

            bgIndex = backgroundId.sort().indexOf(id);

            $('body').css('background-image', 'url(' + backgroundImg[bgIndex] + ')');