HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
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.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
Using packages here is powered by Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<h1 id="titolo-app" class="text-center">Weather App</h1><br>
<p style="text-align: center; color: black">optimized for Firefox</p>
<div class="container-fluid">
<div class="row">
<div class="col-md-9 col-xs-12">
<div id="wrap">
<form name="form" action="" autocomplete="off">
<input id="search-box" class="cerca" type="text" placeholder="Cerca città"><input id="search_submit" value="" type="submit">
<a id="paper-plane" type="submit"><i class="fa fa-paper-plane"></i></a>
</form>
</div>
</div>
<div class="col-md-3 col-xs-12 pulsanti">
<a id="geo"><i class="fa fa-map-marker"></i></a>
<a id="gradiCelsius"><i class="wi wi-celsius"></i></a>
<a id="gradiFarheneit"><i class="wi wi-fahrenheit"></i></a>
</div>
</div>
<div class="row">
<div id="pannello-citta" class="col-lg-6 col-lg-offset-1 col-md-6 col-md-offset-1 col-sm-8 col-sm-offset-2"></div>
<div id="pannello-alba" class="thumb panel panel-primary pannelli-alba-tramonto col-lg-2 col-md-2 col-sm-4 col-sm-offset-1 ">
<div class="panel-heading">Alba</div>
<div class="panel-body">
<img id="" class="img-responsive icona-alba center-block" src="https://res.cloudinary.com/laguno/image/upload/v1482145350/Weather/sunrise.png" alt="">
</div>
<h4 class=" pannello-alba-ora"></h4>
</div>
<div id="pannello-tramonto" class="thumb panel panel-primary pannelli-alba-tramonto col-lg-2 col-md-2 col-sm-4 col-sm-offset-1">
<div class="panel-heading">Tramonto</div>
<div class="panel-body">
<img id="icona-tramonto" class="img-responsive center-block" src="https://res.cloudinary.com/laguno/image/upload/v1482145350/Weather/sunset.png" alt="">
</div>
<h4 class=" pannello-tramonto-ora"></h4>
</div>
</div>
<!-- ----------------------Iniziano i pannelli------------------------------- -->
<div class="row">
<!-- ----------------------Oggi------------------------------- -->
<div class="col-md-4 col-md-offset-0 col-xs-offset-1 col-xs-10">
<div class="panel">
<h4>OGGI</h4>
<hr>
<div class="row">
<h1 id="pannello-temperatura-attuale" class="pannello-temperatura col-lg-4 col-md-4 col-xs-4 "></h1>
<h3 class="cambio-cel-fahr col-lg-4 col-md-4 col-xs-4"> °C</h3>
<img id="icona-tempo-attuale" class="icona-tempo img-responsive center-block col-lg-4 col-md-4 " src="">
</div>
<div class="row">
<h2 id="pannello-tempo-attuale" class="pannello-tempo"></h2>
</div>
<div class="row">
<h4 class="titolo-dettaglio col-lg-6 col-md-6 col-sm-6">Umidità:</h4>
<h5 id="pannello-umidita-attuale" class="pannello-umidita col-lg-4 col-md-4 col-sm-3"></h5>
<img class="icona-umidità img-responsive col-lg-2 col-md-2 col-sm-3" src="https://res.cloudinary.com/laguno/image/upload/v1482146028/Weather/humidity.png" alt="">
</div>
<hr>
<div class="row">
<h4 class="titolo-dettaglio col-lg-6 col-md-6 col-sm-6">Max:</h4>
<h5 id="pannello-max-attuale" class="pannello-max col-lg-4 col-md-4 col-sm-3"></h5>
<img class="icona-max img-responsive col-lg-2 col-md-2 col-sm-3" src="https://res.cloudinary.com/laguno/image/upload/v1482144328/Weather/mercury-thermometer-degrees.png" alt="">
</div>
<hr>
<div class="row">
<h4 class="titolo-dettaglio col-lg-6 col-md-6 col-sm-6">Min:</h4>
<h5 id="pannello-min-attuale" class="pannello-min col-lg-4 col-md-4 col-sm-3"></h5>
<img class="icona-min img-responsive col-lg-2 col-md-2 col-sm-3" src="https://res.cloudinary.com/laguno/image/upload/v1482144328/Weather/mercury-thermometer-degrees_1.png" alt="">
</div>
<hr>
<div class="row">
<h4 class="titolo-dettaglio col-lg-6 col-md-6 col-sm-6">Vento:</h4>
<h5 id="pannello-vento-attuale" class="pannello-vento col-lg-4 col-md-4 col-sm-3"></h5>
<img class="icona-vento img-responsive col-lg-2 col-md-2 col-sm-3" src="https://res.cloudinary.com/laguno/image/upload/v1482151958/Weather/wind-sign.png" alt="">
</div>
<hr>
</div>
</div>
<!-- ----------------------Domani------------------------------- -->
<div class="col-md-4 col-md-offset-0 col-xs-offset-1 col-xs-10">
<div class="panel">
<h4>DOMANI</h4>
<hr>
<div class="row">
<h1 class="pannello-temperatura col-lg-4 col-md-4 col-xs-4"></h1>
<h3 class="cambio-cel-fahr col-lg-4 col-md-4 col-xs-4"> °C</h3>
<img class="icona-tempo img-responsive center-block col-lg-4 col-md-4" src="" alt="">
</div>
<div class="row">
<h2 class="pannello-tempo"></h2>
</div>
<div class="row">
<h4 class="titolo-dettaglio col-lg-6 col-md-6 col-sm-6">Umidità:</h4>
<h5 class="pannello-umidita col-lg-4 col-md-4 col-sm-3"></h5>
<img class="icona-umidità img-responsive col-lg-2 col-md-2 col-sm-3" src="https://res.cloudinary.com/laguno/image/upload/v1482146028/Weather/humidity.png" alt="">
</div>
<hr>
<div class="row">
<h4 class="titolo-dettaglio col-lg-6 col-md-6 col-sm-6">Max:</h4>
<h5 class="pannello-max col-lg-4 col-md-4 col-sm-3"></h5>
<img class="icona-max img-responsive col-lg-2 col-md-2 col-sm-3" src="https://res.cloudinary.com/laguno/image/upload/v1482144328/Weather/mercury-thermometer-degrees.png" alt="">
</div>
<hr>
<div class="row">
<h4 class="titolo-dettaglio col-lg-6 col-md-6 col-sm-6">Min:</h4>
<h5 class="pannello-min col-lg-4 col-md-4 col-sm-3"></h5>
<img class="icona-min img-responsive col-lg-2 col-md-2 col-sm-3" src="https://res.cloudinary.com/laguno/image/upload/v1482144328/Weather/mercury-thermometer-degrees_1.png" alt="">
</div>
<hr>
<div class="row">
<h4 class="titolo-dettaglio col-lg-6 col-md-6 col-sm-6">Vento:</h4>
<h5 class="pannello-vento col-lg-4 col-md-4 col-sm-3"></h5>
<img class="icona-vento img-responsive col-lg-2 col-md-2 col-sm-3" src="https://res.cloudinary.com/laguno/image/upload/v1482151958/Weather/wind-sign.png" alt="">
</div>
<hr>
</div>
</div>
<!-- ----------------------Dopodomani------------------------------- -->
<div class="col-md-4 col-md-offset-0 col-xs-offset-1 col-xs-10">
<div class="panel">
<h4>DOPODOMANI</h4>
<hr>
<div class="row">
<h1 class="pannello-temperatura col-lg-4 col-md-4 col-xs-4"></h1>
<h3 class="cambio-cel-fahr col-lg-4 col-md-4 col-xs-4"> °C</h3>
<img class="icona-tempo img-responsive center-block col-lg-4 col-md-4">
</div>
<div class="row">
<h2 class="pannello-tempo"></h2>
</div>
<div class="row">
<h4 class="titolo-dettaglio col-lg-6 col-md-6 col-sm-6">Umidità:</h4>
<h5 class="pannello-umidita col-lg-4 col-md-4 col-sm-3"></h5>
<img class="icona-umidità img-responsive col-lg-2 col-md-2 col-sm-3" src="https://res.cloudinary.com/laguno/image/upload/v1482146028/Weather/humidity.png" alt="">
</div>
<hr>
<div class="row">
<h4 class="titolo-dettaglio col-lg-6 col-md-6 col-sm-6">Max:</h4>
<h5 class="pannello-max col-lg-4 col-md-4 col-sm-3"></h5>
<img class="icona-max img-responsive col-lg-2 col-md-2 col-sm-3" src="https://res.cloudinary.com/laguno/image/upload/v1482144328/Weather/mercury-thermometer-degrees.png" alt="">
</div>
<hr>
<div class="row">
<h4 class="titolo-dettaglio col-lg-6 col-md-6 col-sm-6">Min:</h4>
<h5 class="pannello-min col-lg-4 col-md-4 col-sm-3"></h5>
<img class="icona-min img-responsive col-lg-2 col-md-2 col-sm-3" src="https://res.cloudinary.com/laguno/image/upload/v1482144328/Weather/mercury-thermometer-degrees_1.png" alt="">
</div>
<hr>
<div class="row">
<h4 class="titolo-dettaglio col-lg-6 col-md-6 col-sm-6">Vento:</h4>
<h5 class="pannello-vento col-lg-4 col-md-4 col-sm-3"></h5>
<img class="icona-vento img-responsive col-lg-2 col-md-2 col-sm-3" src="https://res.cloudinary.com/laguno/image/upload/v1482151958/Weather/wind-sign.png" alt="">
</div>
<hr>
</div>
</div>
</div>
<ul id="slid" class="bxslider">
<li>
<div class="panel-miniature">
<img class="img-responsive col-lg-8 col-md-8 col-sm-6 col-xs-6" src="" />
<h4 class="ora-miniature pull-right col-lg-4 col-md-4 col-sm-6 col-xs-6 "></h4>
</div>
</li>
<li>
<div class="panel-miniature">
<img class="img-responsive col-lg-8 col-md-8 col-sm-6 col-xs-6" src="" />
<h4 class="ora-miniature pull-right col-lg-4 col-md-4 col-sm-6 col-xs-6"></h4>
</div>
</li>
<li>
<div class="panel-miniature">
<img class="img-responsive col-lg-8 col-md-8 col-sm-6 col-xs-6" src="" />
<h4 class="ora-miniature pull-right col-lg-4 col-md-4 col-sm-6 col-xs-6"></h4>
</div>
</li>
<li>
<div class="panel-miniature">
<img class="img-responsive col-lg-8 col-md-8 col-sm-6 col-xs-6" src="" />
<h4 class="ora-miniature pull-right col-lg-4 col-md-4 col-sm-6 col-xs-6"></h4>
</div>
</li>
<li>
<div class="panel-miniature">
<img class="img-responsive col-lg-8 col-md-8 col-sm-6 col-xs-6" src="" />
<h4 class="ora-miniature pull-right col-lg-4 col-md-4 col-sm-6 col-xs-6"></h4>
</div>
</li>
<li>
<div class="panel-miniature">
<img class="img-responsive col-lg-8 col-md-8 col-sm-6 col-xs-6" src="" />
<h4 class="ora-miniature pull-right col-lg-4 col-md-4 col-sm-6 col-xs-6"></h4>
</div>
</li>
</ul>
<!-- -----------------------Video Background-------------------- -->
<video autoplay loop id="video-background" poster="" muted>
<source src="" type="video/mp4" id="prova">
</video>
<!----------------------------------------------------------->
<!-- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.0/jquery-ui.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript" src="bxslider/plugins/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="bxslider/plugins/jquery.fitvids.js"></script>
<script type="text/javascript" src="bxslider/jquery.bxslider.min.js"></script> -->
<!--------------------------Footer--------------------------->
<div class="row">
<footer class="col-lg-12">Realizzato da <a style="margin-left: 10px" href="https://codepen.io/Laguno/" target="_blank"> Alessandro Messori</a><br> <a href="https://it.linkedin.com/in/alessandromessori" target="_blank"><i class="fa fa-linkedin" aria-hidden="true"></i></a>
<a
href="https://mobile.twitter.com/ChicoFmc" target="_blank"><i class="fa fa-twitter" aria-hidden="true"></i></a>
</footer>
</div>
</div>
/* @import url('https://fonts.googleapis.com/css?family=Roboto');
@import url('https://fonts.googleapis.com/css?family=Lato:100,300,400,700');
@import url('https://raw.github.com/FortAwesome/Font-Awesome/master/docs/assets/css/font-awesome.min.css'); */
html,
body {
margin: 0;
font-family: 'Roboto', sans-serif;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
}
@-moz-document url-prefix() {
.bx-viewport {
height: auto !important;
}
.slider,
.bxslider2 {
max-width: 100% !important;
left: auto !important;
}
.bx-controls,
.bx-clone {
display: none;
}
.slider-container .contain-top {
display: none;
}
.slider-menu {
display: none;
}
}
#titolo-app {
color: gold;
}
* {
color: whitesmoke;
}
.container-fluid {
width: 90%;
padding: 15px;
margin-bottom: 5%;
}
hr {
width: 80%;
}
.panel {
margin-left: 10px;
margin-right: 10px;
margin-top: 40px;
margin-bottom: 15%;
color: whitesmoke;
text-align: center;
padding: 20px;
}
.panel-heading {
text-align: center;
}
.panel-footer {
margin-bottom: 0;
}
#pannello-citta {
color: whitesmoke;
text-align: center;
font-size: 40px;
padding: 5px;
}
.pannelli-alba-tramonto {
text-align: center;
height: 100%;
max-height: 150px;
padding: 0 !important;
border: 0.1px solid whitesmoke !important;
}
#pannello-alba,
#pannello-tramonto {
margin: 5px !important;
}
#search,
#geo,
#gradiCelsius,
#gradiFarheneit {
float: right;
width: 50px;
height: 30px;
font-size: 200%;
cursor: pointer;
text-align: center;
}
#geo {
font-size: 180%;
cursor: pointer;
}
#wrap {
position: relative;
height: 60px;
float: right;
padding: 0;
}
input[type=text] {
height: 60px;
font-size: 55px;
font-family: "Lato";
font-weight: 50;
border: none;
outline: none;
color: whitesmoke;
padding: 3px;
padding-right: 60px;
width: 0px;
position: relative;
top: 0;
right: 0;
background: none;
z-index: 3;
transition: width .4s cubic-bezier(0.000, 0.795, 0.000, 1.000);
cursor: pointer;
}
input[type="text"]:focus:hover {
border-bottom: 1px solid whitesmoke;
color: whitesmoke;
}
input[type="text"]:focus {
width: 700px;
z-index: 1;
color: whitesmoke;
border-bottom: 1px solid whitesmoke;
cursor: text;
}
input[type="submit"] {
height: 67px;
width: 63px;
float: right;
background: url(data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTkuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDU2Ljk2NiA1Ni45NjYiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDU2Ljk2NiA1Ni45NjY7IiB4bWw6c3BhY2U9InByZXNlcnZlIiB3aWR0aD0iMzJweCIgaGVpZ2h0PSIzMnB4Ij4KPHBhdGggZD0iTTU1LjE0Niw1MS44ODdMNDEuNTg4LDM3Ljc4NmMzLjQ4Ni00LjE0NCw1LjM5Ni05LjM1OCw1LjM5Ni0xNC43ODZjMC0xMi42ODItMTAuMzE4LTIzLTIzLTIzcy0yMywxMC4zMTgtMjMsMjMgIHMxMC4zMTgsMjMsMjMsMjNjNC43NjEsMCw5LjI5OC0xLjQzNiwxMy4xNzctNC4xNjJsMTMuNjYxLDE0LjIwOGMwLjU3MSwwLjU5MywxLjMzOSwwLjkyLDIuMTYyLDAuOTIgIGMwLjc3OSwwLDEuNTE4LTAuMjk3LDIuMDc5LTAuODM3QzU2LjI1NSw1NC45ODIsNTYuMjkzLDUzLjA4LDU1LjE0Niw1MS44ODd6IE0yMy45ODQsNmM5LjM3NCwwLDE3LDcuNjI2LDE3LDE3cy03LjYyNiwxNy0xNywxNyAgcy0xNy03LjYyNi0xNy0xN1MxNC42MSw2LDIzLjk4NCw2eiIgZmlsbD0iI0ZGRkZGRiIvPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8L3N2Zz4K) center center no-repeat;
text-indent: 10000px;
border: none;
position: absolute;
top: 0;
right: 0;
z-index: 2;
cursor: pointer;
opacity: 0.4;
cursor: pointer;
transition: opacity .4s ease;
color: whitesmoke;
}
#search-box,
#search_submit {
color: whitesmoke;
}
input[type="submit"]:hover {
opacity: 0.9;
color: whitesmoke;
}
#paper-plane {
font-size: 30px;
opacity: 0.5;
display: none;
cursor: pointer;
}
.pannello-temperatura {
padding: 10px;
text-align: right;
}
.cambio-cel-fahr {
padding: 10px;
text-align: left;
}
.panel-miniature {
clear: both;
display: inline-block;
}
.pannello-tempo {
font-size: 25px;
display: block;
border: 1px solid whitesmoke;
padding: 10px;
width: 80%;
margin-left: auto;
margin-right: auto;
}
.pannello-umidita,
.pannello-min,
.pannello-max,
.pannello-vento,
#pannello-vento-attuale,
#pannello-min-attuale,
#pannello-max-attuale,
#pannello-umidita-attuale {
padding: 10px;
font-size: 20px;
}
li {
border: 0.5px solid whitesmoke;
text-align: center
}
.icona-umidità,
.icona-max,
.icona-min,
.icona-vento {
padding: 15px;
}
.titolo-dettaglio {
padding: 15px;
}
.icona-umidità {
content: url(https://res.cloudinary.com/laguno/image/upload/v1482146028/Weather/humidity.png);
}
.icona-max {
content: url(https://res.cloudinary.com/laguno/image/upload/v1482144328/Weather/mercury-thermometer-degrees.png);
}
.icona-min {
content: url(https://res.cloudinary.com/laguno/image/upload/v1482144328/Weather/mercury-thermometer-degrees_1.png);
}
.icona-vento {
content: url(https://res.cloudinary.com/laguno/image/upload/v1482151958/Weather/wind-sign.png);
}
#icona-alba {
content: url(https://res.cloudinary.com/laguno/image/upload/v1482145350/Weather/sunrise.png);
}
#icona-tramonto {
content: url(https://res.cloudinary.com/laguno/image/upload/v1482145350/Weather/sunset.png);
}
ul#slid li {
display: inline;
}
.bx-wrapper .bx-viewport {
background: rgba(60, 142, 203, 0.2);
border: 1px solid whitesmoke;
border-radius: 10px;
}
/* .bxSlider{
min-height: 400px;
} */
.ora-miniature {
padding: 15px;
}
#video-background {
position: fixed;
right: 0;
bottom: 0;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: -100;
}
footer {
text-align: center;
font-size: 15px;
padding: 5px;
}
.fa-twitter,
.fa-linkedin {
margin: 5px;
font-size: 20px;
}
/*MEDIA QUERY */
@media screen and (min-width: 1920px) {
.icona-umidità,
.icona-max,
.icona-min,
.icona-vento {
max-width: 10% !important;
}
.icona-tempo,
#icona-tempo-attuale {
max-height: 20% !important;
max-width: 20% !important;
}
}
@media screen and (min-width: 1200px) {
.icona-umidità,
.icona-max,
.icona-min,
.icona-vento {
max-width: 20%;
}
input[type="text"]:focus {
width: 900px;
}
input[type=text] {
font-size: 30px;
font-family: "Lato";
font-weight: 50;
}
}
@media screen and (max-width: 992px) {
#pannello-alba {
margin-left: 15% !important;
}
input[type="text"]:focus {
width: 600px;
}
input[type=text] {
font-size: 25px;
font-family: "Lato";
font-weight: 90;
}
.icona-umidità,
.icona-max,
.icona-min,
.icona-vento {
max-width: 10% !important;
}
}
@media screen and (max-width: 768px) {
#pannello-alba {
margin-left: 15% !important;
}
/*
.icona-umidità, .icona-max, .icona-min, .icona-vento {
max-width: 10% !important;
}
*/
input[type="text"]:focus {
width: 400px;
}
input[type=text] {
font-size: 22px;
font-family: "Lato";
font-weight: 50;
}
}
@media screen and (min-width: 480px) {
.icona-umidità,
.icona-max,
.icona-min,
.icona-vento {}
input[type="text"]:focus {
width: 300px;
}
input[type=text] {
font-size: 18px;
font-family: "Lato";
font-weight: 50;
}
}
@media screen and (min-width: 320px) {
/*
.icona-umidità, .icona-max, .icona-min, .icona-vento {
max-width: 10% !important;
}
*/
input[type="text"]:focus {
width: 250px;
}
input[type=text] {
font-size: 18px;
font-family: "Lato";
font-weight: 50;
}
}
(function($) {
'use strict';
var apiDaily = "http://api.openweathermap.org/data/2.5/forecast/daily?";
var apiHourly = "http://api.openweathermap.org/data/2.5/forecast?";
var apiToday = "http://api.openweathermap.org/data/2.5/weather?";
var chiaveId = "&appid=deeed8da791aaa9ce48d154821ab2eac";
var giorniDaily = "&cnt=3";
var lingua = "&lang=it";
var giorniHourly = "&cnt=8";
var unità_metrica = "&units=metric";
var resetTemp = 0;
var variazione = 0;
var cloudinary = "https://res.cloudinary.com/laguno/image/upload/v1481799716/Weather/";
var cloudinary_video = "https://res.cloudinary.com/laguno/video/upload/v1482186497/Weather/";
var videoFolders = "weather-video/";
function getWeather(query) {
var urlDaily = apiDaily + chiaveId + query + giorniDaily + lingua;
var urlHourly = apiHourly + chiaveId + query + giorniHourly + lingua;
var urlToday = apiToday + chiaveId + query + lingua;
function getIcon(icon) {
var weather_icon = "";
var video_background = "";
var font_color = "";
var background_panel_color = "";
switch (icon) {
case "01d":
weather_icon = cloudinary + "clear.png";
video_background = cloudinary_video + videoFolders + "clear_sky.mp4";
font_color = "whitesmoke";
background_panel_color = "rgba(60, 142, 203, 0.5)";
break;
case "02d":
weather_icon = cloudinary + "partlycloudy.png";
video_background = cloudinary_video + videoFolders + "partly_cloudy.mp4";
font_color = "rgba(70,80,170)";
background_panel_color = "rgba(150, 200, 200, 0.5)";
break;
case "03d":
weather_icon = cloudinary + "scatteredclouds.png";
video_background = cloudinary_video + videoFolders + "scattered_clouds.mp4";
font_color = "rgba(0, 150, 255)";
background_panel_color = "rgba(255, 255, 255, 0.5)";
break;
case "03n":
weather_icon = cloudinary + "scatteredclouds.png";
video_background = cloudinary_video + videoFolders + "scattered_clouds_night.mp4";
font_color = "whitesmoke";
background_panel_color = "rgba(70, 70, 70, 0.5)";
break;
case "04d":
case "04n":
weather_icon = cloudinary + "hazy.png";
video_background = cloudinary_video + videoFolders + "hazy.mp4";
font_color = "rgba(70,100,80)";
background_panel_color = "rgba(50, 50, 60, 0.5)";
break;
case "09d":
case "09n":
weather_icon = cloudinary + "flurries.png";
video_background = cloudinary_video + videoFolders + "flurries.mp4";
font_color = "black";
background_panel_color = "rgba(50, 50, 50, 0.5)";
break;
case "10d":
weather_icon = cloudinary + "rain02.png";
video_background = cloudinary_video + videoFolders + "rain_day03.mp4";
font_color = "rgba(50,50,100)";
background_panel_color = "rgba(140, 180, 200, 0.5)";
break;
case "11d":
weather_icon = cloudinary + "storms.png";
video_background = cloudinary_video + videoFolders + "storm_day.mp4";
font_color = "whitesmoke";
background_panel_color = "rgba(20, 40, 45, 0.5)";
break;
case "13d":
weather_icon = cloudinary + "snow.png";
video_background = cloudinary_video + videoFolders + "snow_day.mp4";
font_color = "rgba(70, 50, 170)";
background_panel_color = "rgba(160, 230, 255, 0.5)";
break;
case "13n":
weather_icon = cloudinary + "snow.png";
video_background = cloudinary_video + videoFolders + "snow_night.mp4";
font_color = "rgba(20, 10, 105)";
background_panel_color = "rgba(255, 255, 255, 0.5)";
break;
case "50d":
case "50n":
weather_icon = cloudinary + "fog.png";
video_background = cloudinary_video + videoFolders + "fog.mp4";
font_color = "whitesmoke";
background_panel_color = "rgba(130, 130, 130, 0.5)";
break;
case "01n":
weather_icon = cloudinary + "clearnight.png";
video_background = cloudinary_video + videoFolders + "clear_night.mp4";
font_color = "whitesmoke";
background_panel_color = "rgba(60, 60, 100, 0.5)";
break;
case "02n":
weather_icon = cloudinary + "partlycloundynight.png";
video_background = cloudinary_video + videoFolders + "partly_cloundy_night.mp4";
font_color = "rgba(0,0,100)";
background_panel_color = "rgba(180, 180, 230, 0.5)";
break;
case "10n":
weather_icon = cloudinary + "rainnight.png";
video_background = cloudinary_video + videoFolders + "rain_night.mp4";
font_color = "whitesmoke";
background_panel_color = "rgba(90, 90, 90, 0.5)";
break;
case "11n":
weather_icon = cloudinary + "thunderstorms01.png";
video_background = cloudinary_video + videoFolders + "storm.mp4";
font_color = "rgba(255, 200, 0)";
background_panel_color = "rgba(0, 0, 0, 0.5)";
break;
default:
weather_icon = cloudinary + "unknown.png";
}
return [weather_icon, video_background, background_panel_color, font_color];
}
$.get(urlToday, function(data) {
var tempo_attuale = data.weather[0].description;
var temperatura_attuale = Math.floor(data.main.temp - 273.15);
var umidita_attuale = (data.main.humidity);
var alba = new Date(data.sys.sunrise * 1000);
var ora_alba = alba.getHours();
var minuti_alba = "0" + alba.getMinutes();
var tramonto = new Date(data.sys.sunset * 1000);
var ora_tramonto = tramonto.getHours();
var minuti_tramonto = "0" + tramonto.getMinutes();
var sunrise = ora_alba + ':' + minuti_alba.substr(-2);
var sunset = ora_tramonto + ':' + minuti_tramonto.substr(-2);
var weather_icon_code_today = data.weather[0].icon;
var max_today = Math.floor(data.main.temp_max - 273.15);
var min_today = Math.floor(data.main.temp_min - 273.15);
var vento_today = Math.floor(data.wind.speed * 3.6);
var weather_icon_today = getIcon(weather_icon_code_today)[0];
var video_sfondo = getIcon(weather_icon_code_today)[1];
var colore_pannelli = getIcon(weather_icon_code_today)[2];
var colore_font_globale = getIcon(weather_icon_code_today)[3];
$("#pannello-temperatura-attuale").html(temperatura_attuale);
$("#pannello-umidita-attuale").html(umidita_attuale);
$("#pannello-tempo-attuale").html(tempo_attuale);
$(".pannello-alba-ora").html(sunrise);
$(".pannello-tramonto-ora").html(sunset);
$("#icona-tempo-attuale").attr('src', weather_icon_today);
$("#pannello-max-attuale").html(max_today);
$("#pannello-min-attuale").html(min_today);
$("#pannello-vento-attuale").html(vento_today + " km/h");
$("#video-background").attr("src", video_sfondo);
$("*").css("color", colore_font_globale);
$(".panel, .bx-wrapper, .panel-heading , .container-fluid").css("background", colore_pannelli);
});
$.get(urlHourly, function(data) {
//if (index > 0) return;
$(".panel-miniature >img").each(function(index, element) {
if (index > 7) return;
var weather_icon_code_hourly = data.list[index].weather[0].icon;
var weather_icon_hourly = getIcon(weather_icon_code_hourly)[0];
$(element).attr('src', weather_icon_hourly);
});
$(".ora-miniature").each(function(index, element) {
if (index > 7) return;
// console.log("index: "+index+ "element: "+element );
var ora_min = data.list[index].dt_txt;
var ora_miniatura = ora_min.slice(10, 16);
$(element).html(ora_miniatura);
});
});
$.get(urlDaily, function(data) {
$(".pannello-temperatura").each(function(index, element) {
if (index === 0) return;
var temperatura = Math.floor((data.list[index++].temp.day - 273.15));
$(element).html(temperatura);
});
$(".pannello-umidita").each(function(index, element) {
if (index === 0) return;
var umidità = (data.list[index++].humidity);
$(element).text(umidità);
});
$(".pannello-tempo").each(function(index, element) {
if (index === 0) return;
var tempo = data.list[index++].weather[0].description;
$(element).text(tempo);
});
$(".icona-tempo").each(function(index, element) {
if (index === 0) return;
var weather_icon_code = data.list[index++].weather[0].icon;
var weather_icon = getIcon(weather_icon_code)[0];
$(element).attr('src', weather_icon);
});
$(".pannello-max").each(function(index, element) {
if (index === 0) return;
var massima = Math.floor(data.list[index++].temp.max - 273.15);
$(element).text(massima);
});
$(".pannello-min").each(function(index, element) {
if (index === 0) return;
var minima = Math.floor(data.list[index++].temp.min - 273.15);
$(element).text(minima);
});
$(".pannello-vento").each(function(index, element) {
if (index === 0) return;
var vento = Math.floor(data.list[index++].speed * 3.6);
$(element).text(vento + " km/h");
});
$("#pannello-citta").html(data.city.name).slideUp(0).slideDown(900);
});
}
function getWeatherByCity(city) {
resetTemp = 0;
var query = "&q=" + city;
getWeather(query);
}
function getWeatherByGeo(position) {
var query = "&lat=" + position.coords.latitude + "&lon=" + position.coords.longitude;
getWeather(query);
}
$(document).ready(function() {
navigator.geolocation.getCurrentPosition(getWeatherByGeo);
$("#search-box").keyup(function() {
$("#search_submit").hide();
$("#paper-plane").show();
});
$('#search-box').keypress(function(e) {
if (e.which == 13) {
$("#paper-plane").click();
$('#search-box').val("");
return false;
}
});
$("#paper-plane").click(function() {
$(this).hide();
$("#search_submit").show();
var query = $('#search-box').val();
if (query !== "") {
getWeatherByCity(query);
$('input:text').focus(function() {
$(this).val('');
});
}
});
$('#geo').click(function() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(getWeatherByGeo);
$("#gradiFarheneit ,#gradiCelsius").removeClass("btn-info");
$(this).addClass(" btn-info");
}
});
$("#gradiCelsius").click(function() {
if (resetTemp === 0) return;
$("#gradiFarheneit, #geo").removeClass("btn-info");
$(this).addClass(" btn-info");
$(".pannello-temperatura, .pannello-max,.pannello-min, .cambio-cel-fahr").each(function(index, element) {
$(this).fadeToggle(700, function() {
var temp_attuale = parseInt($(this).text());
$(element).html(temp_attuale - 32);
$(".cambio-cel-fahr").html(" °C");
}).slideToggle(700);
resetTemp = 0;
});
});
$("#gradiFarheneit").click(function() {
if (resetTemp === 1) return;
$("#gradiCelsius, #geo").removeClass(" btn-info");
$(this).addClass(" btn-info");
$(".pannello-temperatura, .pannello-max,.pannello-min, .cambio-cel-fahr").each(function(index, element) {
$(this).fadeToggle(700, function() {
var temp_attuale = parseInt($(this).text());
$(element).html(temp_attuale + 32);
$(".cambio-cel-fahr").html(" °F");
}).slideToggle(700);
resetTemp = 1;
});
});
$('.bxslider').bxSlider({
minSlides: 1,
maxSlides: 4,
slideWidth: 270,
slideMargin: 0,
ticker: true,
speed: 20000,
autoDirection: 'next',
tickerHover: true,
options: 'all',
});
});
})(jQuery);
Also see: Tab Triggers