Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <div id="fixed-div">
	<a href="#openModal">About</a>
	<div class="modalDialog" id="openModal">
		<div>
			<a class="close" href="#close" title="Close">X</a>
			<h2 class="text-center">Hi there!</h2>
			<p>This awesome weather app was built as part of my Front End Web Development Certificate at <a href="https://www.freecodecamp.com"
			target="_blank">Free Code Camp</a>.</p>
			<p>To see more of my portfolio please <a href="http://www.jacklyons.me" target="_blank">click here</a>.</p>
		</div>
	</div>
</div>

<div class="container text-center">
	<h1 class="header-text">Jack's Weather App</h1>
	<h4 class="header-text">Click the cloud to begin</h4>
  <!-- A wrapper for CSS-design -->
	<div class="showTemp" id="cloud">
		<span class='shadow'></span>
		<p id="result"></p>
	</div>
  <!-- buttons    -->
  <button class="button button-3d button-circle button-jumbo celsius"><strong>C</strong></button> 
  <button class=
	"button button-3d button-circle button-jumbo fahrenheit"><strong>F</strong></button>
</div>

<footer>
	<p class="footer">Built with &#10084 by <a href="http://www.jacklyons.me" target="_blank">Jack</a></p>
</footer>
              
            
!

CSS

              
                /*Modal ABOUT Box */

#fixed-div {
	position: fixed;
	top: 1em;
	right: 1em;
	font-weight: bold;
	z-index: 999;
}
.modalDialog {
	position: fixed;
	font-family: Roboto, Helvetica, sans-serif;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	background: rgba(0, 0, 0, 0.8);
	z-index: 99999;
	opacity: 0;
	-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
	-webkit-transition: opacity 400ms ease-in;
	transition: opacity 400ms ease-in;
	pointer-events: none;
}
.modalDialog:target {
	opacity: 1;
	-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
	pointer-events: auto;
}
.modalDialog>div {
	width: 70%;
	position: relative;
	margin: 10% auto;
	padding: 5px 20px 13px 20px;
	border-radius: 10px;
	background: skyblue;
	color: white;
	z-index: 999;
}
.close {
	background: #606061;
	color: #FFFFFF;
	line-height: 25px;
	position: absolute;
	right: -12px;
	text-align: center;
	top: -10px;
	width: 24px;
	text-decoration: none;
	font-weight: bold;
	border-radius: 12px;
	box-shadow: 1px 1px 3px #000;
}
.close:hover {
	background: #00d9ff;
}

/* BODY */

h1,
h2,
h3,
h4,
h5,
h6,
p {
	font-family: Roboto, Arial;
}
.header-text {
	font-weight: bold;
	color: white;
	text-shadow: 0px 2px 3px #555;
}
center {
	padding-top: 50px;
}
#result {
	font-weight: bold;
	font-size: 2em;
	color: white;
}
.tempToggle {
	cursor: pointer;
}
.button {
	margin-top: 20px;
	margin-left: 10px;
	margin-right: 20px;
	background-color: lightgreen;
	color: white;
}
.button:hover,
.button:nth-of-type(2):hover {
	background-color: papayawhip;
	color: steelblue;
}
.button:nth-of-type(2) {
	background-color: plum;
}
.button:focus,
.button:nth-of-type(2):focus {
	background-color: lightsalmon;
}

footer {
  position: relative;
  bottom: -10px;
	margin-top: 50px;
  text-align: center;
}

/* CLOUD */

body {
	background: skyblue;
}
#cloud {
	width: 350px;
	height: 120px;
	background: #f2f9fe;
	background: linear-gradient(top, #f2f9fe 5%, #d6f0fd 100%);
	background: -webkit-linear-gradient(top, #f2f9fe 5%, #d6f0fd 100%);
	background: -o-linear-gradient(top, #f2f9fe 5%, #d6f0fd 100%);
	border-radius: 100px;
	-webkit-border-radius: 100px;
	-moz-border-radius: 100px;
	position: relative;
	margin: 120px auto 20px;
}
#cloud:after,
#cloud:before {
	content: '';
	position: absolute;
	background: #f2f9fe;
	z-index: -1;
}
#cloud:after {
	width: 100px;
	height: 100px;
	top: -50px;
	left: 50px;
	border-radius: 100px;
	-webkit-border-radius: 100px;
	-moz-border-radius: 100px;
}
#cloud:before {
	width: 180px;
	height: 180px;
	top: -90px;
	right: 50px;
	border-radius: 200px;
	-webkit-border-radius: 200px;
	-moz-border-radius: 200px;
}
#cloud:hover,
#cloud:hover:after,
#cloud:hover:before {
	cursor: pointer;
	background: blue;
}
#cloud:active,
#cloud:active:after,
#cloud:active:before {
	cursor: pointer;
	background: aqua;
}
.shadow {
	width: 350px;
	position: absolute;
	bottom: -5px;
	left: 20px;
	background: #000;
	z-index: -1;
	box-shadow: 0 0 25px 4px rgba(0, 0, 0, 0.4);
	-moz-box-shadow: 0 0 25px 4px rgba(0, 0, 0, 0.4);
	-webkit-box-shadow: 0 0 25px 4px rgba(0, 0, 0, 0.4);
	border-radius: 50%;
	-moz-border-radius: 50%;
	-webkit-border-radius: 50%;
}

/* CLOUD MEDIA QUERIES */

@media only screen and (max-width: 380px) {
	#cloud {
		width: 175px;
		height: 60px;
		background: #f2f9fe;
		background: linear-gradient(top, #f2f9fe 5%, #d6f0fd 100%);
		background: -webkit-linear-gradient(top, #f2f9fe 5%, #d6f0fd 100%);
		background: -o-linear-gradient(top, #f2f9fe 5%, #d6f0fd 100%);
		border-radius: 50px;
		-webkit-border-radius: 50px;
		-moz-border-radius: 50px;
		position: relative;
		margin: 120px auto 20px;
	}
	#cloud:after,
	#cloud:before {
		content: '';
		position: absolute;
		background: #f2f9fe;
		z-index: -1
	}
	#cloud:after {
		width: 50px;
		height: 50px;
		top: -25px;
		left: 25px;
		border-radius: 50px;
		-webkit-border-radius: 50px;
		-moz-border-radius: 50px;
	}
	#cloud:before {
		width: 90px;
		height: 90px;
		top: -45px;
		right: 25px;
		border-radius: 100px;
		-webkit-border-radius: 100px;
		-moz-border-radius: 100px;
	}
	#result {
		font-weight: bold;
		font-size: 1em;
		padding-top: 0px;
	}
	button {
		-webkit-transform: scale(.8);
		        transform: scale(.8);
	}
}
              
            
!

JS

              
                $(document).ready(function() {
  var location = "http://ip-api.com/json";
  $("#cloud").on("click", function() {
    $.getJSON(location, function(data) {
      var lat = data.lat;
      var lon = data.lon;
      // Use JSON function to request the JSON file
      // GET data from the Open Weather server
      // The data parameter is coming straight from the apiURL
      $.getJSON(
        "http://api.openweathermap.org/data/2.5/weather?lat=" +
          lat +
          "&lon=" +
          lon +
          "&appid=5f7bcf238dc7056a7325948af9cb61be",
        function(data) {
          console.table(data);
          temperature = Math.floor(data.main.temp) / 10;
          var city = data.name;
          var description = data.weather[0].main;
          // Output data over the cloud :)

          $("#result")
            .css("color", "black")
            .html(
              temperature +
                "°" +
                "C" +
                " and " +
                description +
                "<br>" +
                "in " +
                city
            );
          // If statement (also could be done using "case")
          // Smaller images/graphics could have been used to make load times faster
          if (description === "Clouds") {
            $("body").css("background", "lightsteelblue");
          } else if (description === "Rain") {
            $("body").css("background", "steelblue");
          } else if (description === "Clear") {
            $("body").css("background", "azure");
          } else if (description === "Snow") {
            $("body").css("background", "snow");
          } else if (description === "Thunderstorm") {
            $("body").css("background", "yellowgreen");
          } else {
            $("body").css("background", "papayawhip");
          }

          // onClick to Farenheight / Celcius
          $(".celsius").click(function() {
            $("#result")
              .empty()
              .html(
                temperature +
                  "°" +
                  "C" +
                  " and " +
                  description +
                  "<br>" +
                  "in " +
                  city
              );
          });
          $(".fahrenheit").click(function() {
            $("#result")
              .empty()
              .html(
                Math.round(temperature * 9 / 5 + 32) +
                  "°" +
                  "F" +
                  " and " +
                  description +
                  "<br>" +
                  "in " +
                  city
              );
          });
        }
      ); // CLOSE data function
    }); // CLOSE ajax function
  });
}); //CLOSE showTemp function

              
            
!
999px

Console