Weather widget

Size
4,423 Kb
Views
18,216

How do I make an weather widget?

This weather widget is a merge of two awesome plugins: SimpleWeather & OwlCarousel.You can have as many weather locations by simply entering the WOEID in the "data-woeid" field of the div. . What is a weather widget? How do you make a weather widget? This script and codes were developed by Mauritius D'Silva on 16 November 2022, Wednesday.

Weather widget Previews

Weather widget - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Weather widget</title> <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.carousel.min.css'>
<link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.theme.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <h1>Weather Widget</h1>
<p>This weather widget is a merge of two awesome plugins: <strong>SimpleWeather</strong> &amp; <strong>OwlCarousel</strong>.<br />You can have as many weather locations by simply entering the <strong>WOEID</strong> in the "data-woeid" field of the div. <br>For each WOEID DOM element, the script will create one Owl Carousel slide. Go ahead, try it out!</p>
<div class="weather-container"> <h2>What’s the weather like today?</h2> <div class="owl-carousel owl-theme"> <!-- Get your location WOEID (Where On Earth IDentifier) from here: https://woeid.rosselliot.co.nz/ --> <div class="weather" data-woeid="2459115"></div> <div class="weather" data-woeid="721943"></div> <div class="weather" data-woeid="2295411"></div> </div>
</div>
<!-- /.weather-container --> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.carousel.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery.simpleWeather/3.0.2/jquery.simpleWeather.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Weather widget - Script Codes CSS Codes

/* Weather Plugin: http://simpleweatherjs.com Font Weather icon font: http://fonts.artill.de/collection/artill-weather-icons Owl Carousel: http://owlgraphic.com/owlcarousel/ DO NOT hotlink the assets/font included in this demo. If you wish to use the same font icon then download it to your local assets at the link above. If you use the links below odds are at some point they will be removed and your version will break.
*/
/* Demo Fonts */
@import url(https://fonts.googleapis.com/css?family=Raleway:400,100);
@import url(https://fonts.googleapis.com/css?family=Lato:400,300);
@font-face { font-family: 'weather'; src: url('https://copy.com/69Xwm8Yz0KidZIXe'); src: url('https://dl.dropboxusercontent.com/s/ja5qsu8ugaeo8lo/artill_clean_icons-webfont.eot?dl=0?#iefix') format('embedded-opentype'), url('https://copy.com/10IHFGnKJoM1rwDK') format('woff'), url('https://copy.com/v6pbRspmfTVN1XMh') format('truetype'), url('https://copy.com/mYSn61H6wBQYFTme#artill_clean_weather_iconsRg') format('svg'); font-weight: normal; font-style: normal;
}
html { width: 100%; height: 100%; background: #1192d3;
}
body { padding: 45px 0; font: normal 13px 'Raleway', Arial, sans-serif; color:#fff;
}
a:link,
a:active,
a:visited{ color:#fff; text-decoration:underline; color:rgba(0, 0, 0, .8);
}
a:hover{ color:rgba(0, 0, 0, .5);
}
h1{ margin: 0 0 20px 0; padding:0; text-align:center; color:#fff;
}
p{ text-align:center; font: normal 16px/24px 'Lato', Arial, sans-serif;
}
.weather-container { position: relative; width: 260px; margin: 0px auto; padding: 5px 20px; color: #fff; box-shadow: 1px 2px 4px 0px rgba(0, 0, 0, 0.25); background-image: linear-gradient(-43deg, rgba(152, 38, 168, 0.60) 0%, #654DB5 70%), url('https://copy.com/V9Xx12TeLXA4Xox2'); background-position: 0px 0px; background-repeat: repeat-x; animation: animatedbg 180s linear infinite;
}
.weather-container h1 { margin: 0; padding: 0; line-height: .8; color: rgba(255, 255, 255, .6); font: 300 60px 'Lato', "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}
.weather-container > h2 { text-align: center; font: 20px 'Raleway', "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}
.weather { margin: 0px auto; text-align: center;
}
i { display: inline-block; color: rgba(255, 255, 255, .6); font-weight: 300; font-family: weather; font-size: 100px; font-style: normal; font-weight: 300; line-height: .8;
}
.icon-0:before { content: ":"; }
.icon-1:before { content: "p"; }
.icon-2:before { content: "S"; }
.icon-3:before { content: "Q"; }
.icon-4:before { content: "S"; }
.icon-5:before { content: "W"; }
.icon-6:before { content: "W"; }
.icon-7:before { content: "W"; }
.icon-8:before { content: "W"; }
.icon-9:before { content: "I"; }
.icon-10:before { content: "W"; }
.icon-11:before { content: "I"; }
.icon-12:before { content: "I"; }
.icon-13:before { content: "I"; }
.icon-14:before { content: "I"; }
.icon-15:before { content: "W"; }
.icon-16:before { content: "I"; }
.icon-17:before { content: "W"; }
.icon-18:before { content: "U"; }
.icon-19:before { content: "Z"; }
.icon-20:before { content: "Z"; }
.icon-21:before { content: "Z"; }
.icon-22:before { content: "Z"; }
.icon-23:before { content: "Z"; }
.icon-24:before { content: "E"; }
.icon-25:before { content: "E"; }
.icon-26:before { content: "3"; }
.icon-27:before { content: "a"; }
.icon-28:before { content: "A"; }
.icon-29:before { content: "a"; }
.icon-30:before { content: "A"; }
.icon-31:before { content: "6"; }
.icon-32:before { content: "1"; }
.icon-33:before { content: "6"; }
.icon-34:before { content: "1"; }
.icon-35:before { content: "W"; }
.icon-36:before { content: "1"; }
.icon-37:before { content: "S"; }
.icon-38:before { content: "S"; }
.icon-39:before { content: "S"; }
.icon-40:before { content: "M"; }
.icon-41:before { content: "W"; }
.icon-42:before { content: "I"; }
.icon-43:before { content: "W"; }
.icon-44:before { content: "a"; }
.icon-45:before { content: "S"; }
.icon-46:before { content: "U"; }
.icon-47:before { content: "S"; }
.weather h2 { margin: 0; padding: 0 0 10px 0; color: #fff; font-size: 24px; font-weight: 300; text-align: center;
}
.weather ul { margin: 0; padding: 0;
}
.weather ul li { /*color: #654DB5;*/ background: rgba(0, 0, 0, .2); padding: 5px 10px; border-radius: 18px; display: inline-block;
}
.weather .currently { margin: 0 20px;
}
.weather .updated { border-top: 1px solid rgba(255, 255, 255, 0.2); color: rgba(255, 255, 255, 0.5); padding-top: 5px; line-height: 1.4; font-size:13px;
}
.weather .updated > span { display: block; font-style: italic;
}
/* Owl Carousel pagination buttons CSS */
/* -------------------------------------------------- */
.owl-theme .owl-controls .owl-page span { background: #fff;
}
.owl-theme .owl-controls .owl-page.active span:before { position: relative; content: ''; display: block; z-index: 999999; width: 16px; height: 16px; left: -4px; top: -4px; border: solid 2px rgba(255, 255, 255, 1); -webkit-border-radius: 20px; -moz-border-radius: 20px; border-radius: 20px; animation: popout .4s ease-in-out forwards;
}
/* Animations */
/* -------------------------------------------------- */
@-webkit-keyframes popout { 0 { transform: scale(0); } 50% { transform: scale(.5); } 75% { transform: scale(1.1); } 100% { transform: scale(1); }
}
@-o-keyframes popout { 0 { transform: scale(0); } 50% { transform: scale(.5); } 75% { transform: scale(1.1); } 100% { transform: scale(1); }
}
@-moz-keyframes popout { 0 { transform: scale(0); } 50% { transform: scale(.5); } 75% { transform: scale(1.1); } 100% { transform: scale(1); }
}
@keyframes popout { 0 { transform: scale(0); } 50% { transform: scale(.5); } 75% { transform: scale(1.1); } 100% { transform: scale(1); }
}
@-webkit-keyframes animatedbg { from { background-position: 0 0; } to { background-position: 100% 0; }
}
@-o-keyframes animatedbg { from { background-position: 0 0; } to { background-position: 100% 0; }
}
@-moz-keyframes animatedbg { from { background-position: 0 0; } to { background-position: 100% 0; }
}
@keyframes animatedbg { from { background-position: 0 0; } to { background-position: 100% 0; }
}
@-webkit-keyframes popout { 0 { transform: scale(0); } 50% { transform: scale(.5); } 75% { transform: scale(1.1); } to { transform: scale(1); }
}
@-o-keyframes popout { 0 { transform: scale(0); } 50% { transform: scale(.5); } 75% { transform: scale(1.1); } to { transform: scale(1); }
}
@-moz-keyframes popout { 0 { transform: scale(0); } 50% { transform: scale(.5); } 75% { transform: scale(1.1); } to { transform: scale(1); }
}
@keyframes popout { 0 { transform: scale(0); } 50% { transform: scale(.5); } 75% { transform: scale(1.1); } to { transform: scale(1); }
}

Weather widget - Script Codes JS Codes

jQuery(document).ready(function($) { $(function() { $('div').find('*[data-woeid]').each(function() { var el = $(this); $.simpleWeather({ location: '', woeid: $(el).data('woeid'), unit: 'c', success: function(weather) { html = '<h1 class="weather-header"><i class="icon-' + weather.code + '"></i>' + ' ' + weather.temp + '<sup>&deg;</sup>' + weather.units.temp + '</h1><h2>' + weather.city + ' ' + weather.region + '</h2>'; html += '<ul><li class="currently">' + weather.currently + '</li></ul>'; html += '<p class="updated">Updated at <span>' + weather.updated + '</span></p>'; $(el).html(html); }, error: function(error) { $(el).html('<p>' + error.message + '</p>'); } }); }); }); var owl = $('.weather-container > .owl-carousel'); owl.owlCarousel({ navigation: false, // Show next and prev buttons slideSpeed: 300, paginationSpeed: 400, singleItem: true, autoPlay: 3000, stopOnHover: true });
});
Weather widget - Script Codes
Weather widget - Script Codes
Home Page Home
Developer Mauritius D'Silva
Username mauritiusdsilva
Uploaded November 16, 2022
Rating 3
Size 4,423 Kb
Views 18,216
Do you need developer help for Weather widget?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Mauritius D'Silva (mauritiusdsilva) Script Codes
Create amazing captions with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!