cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

            
              <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta charset="UTF-8">

    <!-- jquery-->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
    <!-- Latest compiled and minified JavaScript -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
    <!--fonts from google-->
    <link href="https://fonts.googleapis.com/css?family=Asap:400,400i|Flamenco|Josefin+Sans:300,400" rel="stylesheet">
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

</head>

<div class="container-fluid body">
	<!-- background video-->

<!--<iframe id="bgvid" src="https://www.youtube.com/embed/Cr1cx0wEyhk?autoplay=1&amp;controls=0&amp;loop=1&amp;showinfo=0&amp;modestbranding=1&amp;diablekb=0&amp;enablejsapi=1&amp;rel=0&amp;m=1" frameborder="0" allowfullscreen></iframe>-->
        <div class="header-box">
            <div class="row">

                <div class=" col-xs-1 col-xs-offset-1">
                    <div id="hearder-time">
                        <p>10:19am</p>
                    </div>
                </div>
                <div class=" col-lg-3 col-lg-offset-7 col-md-3 col-md-offset-6 col-sm-4 col-sm-offset-6 col-xs-6 col-xs-offset-3 ">
                    <div id="header-icon">

                        <p id="date"> October 21, 2016</p>
                    </div>


                </div>
            </div>
        </div>


	<div class="container">
		<div class="row ">

			<div class="content-info  text-center col-sm-6 col-sm-offset-3 col-xs-10 col-xs-offset-1 ">

				<p id="location">Brooklyn NY</p>
				<i id="daily-icon" class="wi wi-night-sleet"></i>
				<p id="conditions">snow</p>
				<div class="temp">
					<h1 id="fahrenheit"></h1>
					<p id="celsius"></p>
				</div>


				<div id="sun" class="row">
					<div class="col-sm-3 col-sm-offset-1">
						<i class=" sun-icon wi wi-sunrise"></i>
					</div>
					<div class="col-sm-3 col-sm-offset-4">
						<i class=" sun-icon wi wi-sunset"></i>
					</div>
					<div class="col-sm-3 col-sm-offset-1">
						<p id="sunrise">5:00am</p>
					</div>
					<div class="col-sm-3 col-sm-offset-4">
						<p id="sunset">5:00pm</p>
					</div>
				</div>

			</div>
		</div>

	</div>
	<div class="forecast row text-center">
		<div class="col-xs-2 col-xs-offset-1 day hvr-float-shadow ">
			<p id="weekday1"></p>
			<p id="dayCon1"></p>
			<p id="dayIcon1"></p>
			<p id="tempHigh1"></p>
			<p id="celsiusHigh1"></p>
			<p id="tempLow1"></p>


		</div>
		<div class="col-xs-2 day hvr-float-shadow ">
			<p id="weekday2"></p>
			<p id="dayCon2"></p>
			<p id="dayIcon2"></p>

			<p id="tempHigh2"></p>
			<p id="tempLow2"></p>

		</div>
		<div class="col-xs-2 day  hvr-float-shadow">
			<p id="weekday3"></p>
			<p id="dayCon3"></p>
			<p id="dayIcon3"></p>
			<p id="tempHigh3"></p>

			<p id="tempLow3"></p>

		</div>
		<div class="col-xs-2 day hvr-float-shadow ">
			<p id="weekday4"></p>
			<p id="dayCon4"></p>
			<p id="dayIcon4"></p>
			<p id="tempHigh4"></p>

			<p id="tempLow4"></p>
		</div>
		<div class="col-xs-2 day hvr-float-shadow ">
			<p id="weekday5"></p>
			<p id="dayCon5"></p>
			<p id="dayIcon5"></p>
			<p id="tempHigh5"></p>

			<p id="tempLow5"></p>

		</div>

	</div>
</div>
            
          
!
            
              /* Float Shadow */
.hvr-float-shadow {
  display: inline-block;
  vertical-align: middle;
  -webkit-transform: perspective(1px) translateZ(0);
  transform: perspective(1px) translateZ(0);
  box-shadow: 0 0 1px transparent;
  position: relative;
  -webkit-transition-duration: 0.3s;
  transition-duration: 0.3s;
  -webkit-transition-property: transform;
  transition-property: transform;
}
.hvr-float-shadow:before {
  pointer-events: none;
  position: absolute;
  z-index: -1;
  content: '';
  top: 100%;
  left: 5%;
  height: 10px;
  width: 90%;
  opacity: 0;
  background: -webkit-radial-gradient(center, ellipse, rgba(0, 0, 0, 0.35) 0%, transparent 80%);
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.35) 0%, transparent 80%);
  /* W3C */
  -webkit-transition-duration: 0.3s;
  transition-duration: 0.3s;
  -webkit-transition-property: transform, opacity;
  transition-property: transform, opacity;
}
.hvr-float-shadow:hover, .hvr-float-shadow:focus, .hvr-float-shadow:active {
  -webkit-transform: translateY(-5px);
  transform: translateY(-5px);
  /* move the element up by 5px */
}
.hvr-float-shadow:hover:before, .hvr-float-shadow:focus:before, .hvr-float-shadow:active:before {
  opacity: 1;
  -webkit-transform: translateY(5px);
  transform: translateY(5px);
  /* move the element down by 5px (it will stay in place because it's attached to the element that also moves up 5px) */
}

.body{background:#00cccc;}
p {
    font-family: 'Josefin Sans', sans-serif;
    color: white;
}




.header-box {
    margin: 2% 0px;
}

#hearder-time p {
    font-family: 'Josefin Sans', sans-serif;
    color: white;
    font-size: 20px;
}



#date {
	font-size:20px;
}

.content-info {
    font-size: 16px;
    padding: 10px 0px;
    font-family: 'Flamenco', cursive;
    color: white;
    background: rgba(0, 0, 0, .6);
    border-radius: 25px;
}

.content-info p {
    font-size: 24px;
}

#daily-icon {
    font-size: 100px;
    margin-bottom: 20px;
}

#sun {
    margin-top: 20px;
}

.sun-icon {
    font-size: 24px;
}

#sun p {
    font-size: 16px;
}

.temp #fahrenheit {
    display: inline-block;
    font-size: 100px;
}

#fahrenheit:hover {
    color: aqua;
}

.temp #celsius {
    margin-top: -15px;
    display: inline-block;
}

.forecast {
    margin: 20px;
}

.day {
    padding: 10px 0px;
    margin: 0px 5px;
    background: rgba(0, 0, 0, .3);
    border-radius: 10px;
}

            
          
!
            
              // if geolocation can be accessed on the browser
if (navigator.geolocation) {
	/*--the run the geolocation code that has a structure of navigator.geolocation.getCurrentPosition(success[, error[, options]])
	this is refernced from https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition

	the success portion of the code is a function. in this case its function is function myLocation(postion){-----} calling to display location at the end of the function before closing
	--*/
	navigator.geolocation.getCurrentPosition(

		function myLocation(position) {
			var lat = position.coords.latitude;
			var long = position.coords.longitude;

			// side note: the below call the latitude and longitude and places it in the #location
			//$("#location").html("latitude: " + lat + "<br>longitude: " + long);

			/*-- syntax for using api -- $(selector).getJSON(url,data,success(data,status,xhr)) --as provided by -- https://www.w3schools.com/jquery/ajax_getjson.asp--*/
			// the below is to display the address as city and country using the yahoo API
			/*--this site helped me figure out how to link my "lat" and "long" to the yahoo api--https://stackoverflow.com/questions/how-to-answer?questionid=35220361&reason=thankyou&s=f893fda3-48a5-4d8d-9531-9bf5d65d2be0--*/
			var api = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(SELECT%20woeid%20FROM%20geo.places%20WHERE%20text%3D%22(" + lat + "%2C" + long + ")%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys";

			$(document).ready(function() {
				$.getJSON(api, function(json) {
					/*-- this code reveals all of the infomation in the JSON --$("#location").html(JSON.stringify(json))--*/
					// parsing  the information to only pull out what I need

					/*-- main content info--*/
					var fahrenheit = Math.round(json.query.results.channel.item.condition.temp);
					var celsius = Math.round((fahrenheit - 32) / 1.8);
					var conditions = json.query.results.channel.item.condition.text;

					/*-- forcast--*/
					var weekday1 = json.query.results.channel.item.forecast[1].day;
					var weekday2 = json.query.results.channel.item.forecast[2].day;
					var weekday3 = json.query.results.channel.item.forecast[3].day;
					var weekday4 = json.query.results.channel.item.forecast[4].day;
					var weekday5 = json.query.results.channel.item.forecast[5].day;
					/*-- forcast daily conditions--*/
					var dayCon1 = json.query.results.channel.item.forecast[1].text;
					var dayCon2 = json.query.results.channel.item.forecast[2].text;
					var dayCon3 = json.query.results.channel.item.forecast[3].text;
					var dayCon4 = json.query.results.channel.item.forecast[4].text;
					var dayCon5 = json.query.results.channel.item.forecast[5].text;

					/*-- forcast daily conditions made into array for image change function--*/
					var dayConChange1 = dayCon1.split(" ");
					var dayConChange2 = dayCon2.split(" ");
					var dayConChange3 = dayCon3.split(" ");
					var dayConChange4 = dayCon4.split(" ");
					var dayConChange5 = dayCon5.split(" ");
					/*-- forcast daily high temp--*/

					var tempHigh1 = json.query.results.channel.item.forecast[1].high;
					var tempHigh2 = json.query.results.channel.item.forecast[2].high;
					var tempHigh3 = json.query.results.channel.item.forecast[3].high;
					var tempHigh4 = json.query.results.channel.item.forecast[4].high;
					var tempHigh5 = json.query.results.channel.item.forecast[5].high;
					/*-- forcast daily low temp--*/
					var tempLow1 = json.query.results.channel.item.forecast[1].low;
					var tempLow2 = json.query.results.channel.item.forecast[2].low;
					var tempLow3 = json.query.results.channel.item.forecast[3].low;
					var tempLow4 = json.query.results.channel.item.forecast[4].low;
					var tempLow5 = json.query.results.channel.item.forecast[5].low;

					var vidchange = conditions.split(" ");
					var city = json.query.results.channel.location.city;
					var state = json.query.results.channel.location.region;
					var sunrise = json.query.results.channel.astronomy.sunrise;
					var sunset = json.query.results.channel.astronomy.sunset;
					var location = city + "," + state;
					var swap = true;
					var d = new Date();
					var date = d.toLocaleDateString();
					var vid = document.getElementById("change");
					var dailyIcon = document.getElementById("daily-icon");

					$("#weekday1").html(weekday1);
					$("#weekday2").html(weekday2);
					$("#weekday3").html(weekday3);
					$("#weekday4").html(weekday4);
					$("#weekday5").html(weekday5);
					$("#dayCon1").html(dayCon1);
					$("#dayCon2").html(dayCon2);
					$("#dayCon3").html(dayCon3);
					$("#dayCon4").html(dayCon4);
					$("#dayCon5").html(dayCon5);

					$("#tempHigh1").html("High: " + tempHigh1 + "&#730;" + "f");
					$("#tempHigh2").html("High: " + tempHigh2 + "&#730;" + "f");
					$("#tempHigh3").html("High: " + tempHigh3 + "&#730;" + "f");
					$("#tempHigh4").html("High: " + tempHigh4 + "&#730;" + "f");
					$("#tempHigh5").html("High: " + tempHigh5 + "&#730;" + "f");
					$("#tempLow1").html("Low: " + tempLow1 + "&#730;" + "f");
					$("#tempLow2").html("Low: " + tempLow2 + "&#730;" + "f");
					$("#tempLow3").html("Low: " + tempLow3 + "&#730;" + "f");
					$("#tempLow4").html("Low: " + tempLow4 + "&#730;" + "f");
					$("#tempLow5").html("Low: " + tempLow5 + "&#730;" + "f");

					$("#date").html(date);
					$("#location").html(location);
					$("#state").html(state);
					$("#sunrise").html("Sunrise: " + sunrise);
					$("#sunset").html("Sunset: " + sunset);
					$("#conditions").html(conditions);
					$("#celsius").html(" / " + celsius + "&#730;" + "C");
					$("#fahrenheit").html(fahrenheit + "&#730;" + "f");

					$(document).ready(function() {
						$(".temp").click(function() {
							if (swap === false) {
								$("#fahrenheit").html(celsius + "&#730;" + "c");
								$("#celsius").html(" / " + fahrenheit + "&#730;" + "F");
								swap = true;
							} else {
								$("#fahrenheit").html(fahrenheit + "&#730;" + "f");
								$("#celsius").html(" / " + celsius + "&#730;" + "C");

								swap = false;
							}
						});
					});

					function weatherChange() {
						for (var i = 0; i < vidchange.length; i++) {

							if (vidchange[i].toLowerCase() == "rain") {

								dailyIcon.setAttribute("class", "wi wi-rain");

								break;

							} else if (vidchange[i].toLowerCase() == "snow") {

								dailyIcon.setAttribute("class", "wi wi-snow");

								break;
							} else if (vidchange[i].toLowerCase() == "cloudy") {

								dailyIcon.setAttribute("class", "wi wi-cloudy");

								break;
							} else if (vidchange[i].toLowerCase() == "sunny") {

								dailyIcon.setAttribute("class", "wi wi-day-sunny");;
								break;
							} else if (vidchange[i].toLowerCase() == "clear") {

								dailyIcon.setAttribute("class", "wi-wu-clear");

								break;
							} else {

								dailyIcon.setAttribute("class", "wi-wu-clear");

							}

						}
					}
					weatherChange();

					function forecast1() {
						for (var i = 0; i < dayConChange1.length; i++) {

							if (dayConChange1[i].toLowerCase() === "rain") {
								dayIcon1.setAttribute("class", "wi wi-rain");
								break;

							} else if (dayConChange1[i].toLowerCase() === "snow") {
								dayIcon1.setAttribute("class", "wi wi-snow");
								break;

							} else if (dayConChange1[i].toLowerCase() === "cloudy") {
								dayIcon1.setAttribute("class", "wi wi-cloudy");
								break;

							} else if (dayConChange1[i].toLowerCase() === "sunny") {
								dayIcon1.setAttribute("class", "wi wi-day-sunny");
								break;

							} else if (dayConChange1[i].toLowerCase() === "clear") {
								dayIcon1.setAttribute("class", "wi-wu-clear");
								break;

							} else {
								dayIcon1.setAttribute("class", "wi-wu-clear");

							}

						}
					}
					forecast1();

					function forecast2() {
						for (var i = 0; i < dayConChange2.length; i++) {

							if (dayConChange2[i].toLowerCase() === "rain") {
								dayIcon2.setAttribute("class", "wi wi-rain");
								break;

							} else if (dayConChange2[i].toLowerCase() === "snow") {
								dayIcon2.setAttribute("class", "wi wi-snow");
								break;

							} else if (dayConChange2[i].toLowerCase() === "cloudy") {
								dayIcon2.setAttribute("class", "wi wi-cloudy");
								break;

							} else if (dayConChange2[i].toLowerCase() === "sunny") {
								dayIcon2.setAttribute("class", "wi wi-day-sunny");
								break;

							} else if (dayConChange2[i].toLowerCase() === "clear") {
								dayIcon2.setAttribute("class", "wi-wu-clear");
								break;

							} else {
								dayIcon2.setAttribute("class", "wi-wu-clear");

							}

						}
					}
					forecast2();

					function forecast3() {
						for (var i = 0; i < dayConChange3.length; i++) {

							if (dayConChange3[i].toLowerCase() === "rain") {
								dayIcon3.setAttribute("class", "wi wi-rain");
								break;

							} else if (dayConChange3[i].toLowerCase() === "snow") {
								dayIcon3.setAttribute("class", "wi wi-snow");
								break;

							} else if (dayConChange3[i].toLowerCase() === "cloudy") {
								dayIcon3.setAttribute("class", "wi wi-cloudy");
								break;

							} else if (dayConChange3[i].toLowerCase() === "sunny") {
								dayIcon3.setAttribute("class", "wi wi-day-sunny");
								break;

							} else if (dayConChange3[i].toLowerCase() === "clear") {
								dayIcon3.setAttribute("class", "wi-wu-clear");
								break;

							} else {
								dayIcon3.setAttribute("class", "wi-wu-clear");

							}

						}
					}
					forecast3();

					function forecast4() {
						for (var i = 0; i < dayConChange4.length; i++) {

							if (dayConChange4[i].toLowerCase() === "rain") {
								dayIcon4.setAttribute("class", "wi wi-rain");
								break;

							} else if (dayConChange4[i].toLowerCase() === "snow") {
								dayIcon3.setAttribute("class", "wi wi-snow");
								break;

							} else if (dayConChange4[i].toLowerCase() === "cloudy") {
								dayIcon4.setAttribute("class", "wi wi-cloudy");
								break;

							} else if (dayConChange4[i].toLowerCase() === "sunny") {
								dayIcon4.setAttribute("class", "wi wi-day-sunny");
								break;

							} else if (dayConChange4[i].toLowerCase() === "clear") {
								dayIcon4.setAttribute("class", "wi-wu-clear");
								break;

							} else {
								dayIcon4.setAttribute("class", "wi-wu-clear");

							}

						}
					}
					forecast4();

					function forecast5() {
						for (var i = 0; i < dayConChange5.length; i++) {

							if (dayConChange5[i].toLowerCase() === "rain") {
								dayIcon5.setAttribute("class", "wi wi-rain");
								break;

							} else if (dayConChange5[i].toLowerCase() === "snow") {
								dayIcon5.setAttribute("class", "wi wi-snow");
								break;

							} else if (dayConChange5[i].toLowerCase() === "cloudy") {
								dayIcon5.setAttribute("class", "wi wi-cloudy");
								break;

							} else if (dayConChange5[i].toLowerCase() === "sunny") {
								dayIcon5.setAttribute("class", "wi wi-day-sunny");
								break;

							} else if (dayConChange5[i].toLowerCase() === "clear") {
								dayIcon5.setAttribute("class", "wi wi-day-sunny");
								break;

							} else {
								dayIcon5.setAttribute("class", "wi wi-day-sunny");

							}

						}
					}
					forecast5();

				});

			});
		});
}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console