Skip to content

Clean, attractive weather widget all in one `<script>` tag, built with Fomantic UI (community fork of Semantic UI) https://weather-widget.imfast.io/

License

Notifications You must be signed in to change notification settings

kathawala/weather-widget

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

weather-widget

A clean, attractive, simple weather widget, all in one <script> tag. Made with Fomantic-UI -- a community fork of Semantic-UI. Provides current weather and a 5 day forecast. Can be set to refresh as often as desired. Specify a different latitude and longitude to get a different forecast.

Check It Out

https://weather-widget.imfast.io/

Screenshot of the weather widget utility, showing the current weather and an 5-day forecast

Usage

Fomantic UI and JQuery are required. You must include JQuery before the Fomantic UI Javascript. You can use the jsDelivr links in the example below, otherwise you'll need to download Fomantic-UI and JQuery from their respective sites and then download and use weather-widget.js from this repo. (ONLY weather-widget.js is needed from this repo. Other files in this repo are for the live example)

In a script tag (before the <script> tag containing weather-widget.js), declare the configuration variables as a variable named fkweatherwidget.

Configuration variables include:

  • elemId: the id of the HTML element you are injecting the weather widget into
  • hourlyRefreshSeconds: the amount of time in seconds to wait before refreshing the hourly forecast
  • weeklyRefreshSeconds: the amount of time in seconds to wait before refreshing the weekly forecast
  • lat: Latitude of the area to get a forecast for
  • lng: Longitude of the area to get a forecast for
<!doctype html>

<html lang="en">
    <head>
	...
	<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/semantic.min.css">
    </head>
    <body>

	...

	<div id="mywidget"></div>

	...

	<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"></script>
	<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/semantic.min.js"></script>
	<script>
	 const fkweatherwidget = {
	     elemId: 'mywidget',
	     hourlyRefreshSeconds: 60 * 60,
	     weeklyRefreshSeconds: 60 * 60,
	     lat: 35.1056,
	     lng: -90.007,
	 }
	</script>
	<script src="https://cdn.jsdelivr.net/gh/kathawala/[email protected]/weather-widget.min.js"></script>
    </body>
</html>

About

Clean, attractive weather widget all in one `<script>` tag, built with Fomantic UI (community fork of Semantic UI) https://weather-widget.imfast.io/

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published