Git Product home page Git Product logo

weather_dashboard's Introduction

Weather Dashboard

A weather dashboard that displays current weather information and a 5-day forecast for a specified location. The dashboard uses the OpenWeatherMap API to fetch weather data and supports fetching weather details of the user's current location by default using the Geolocation API.

Features

  • Fetch and display current weather data including temperature, description, humidity, and wind speed.
  • Fetch and display a 5-day weather forecast.
  • Automatically fetch and display weather data for the user's current location on page load.
  • Search for weather data by entering a location name.
  • Animated cloud background to enhance visual appeal.

Demo

image

Getting Started

Prerequisites

  • A modern web browser with JavaScript enabled.
  • An OpenWeatherMap API key. You can get one by signing up at OpenWeatherMap.

Installation

  1. Clone the repository:
git clone https://github.com/your-username/weather-dashboard.git
cd weather-dashboard
  1. In your script.js file add your OpenWeatherMap API key:

API_KEY=your_openweathermap_api_key

Open index.html in your web browser.

Usage

Open index.html in your web browser. The dashboard will automatically fetch and display the weather data for your current location. To search for weather data for a specific location, enter the location name in the search box and click the "Search" button.

Code Overview

HTML

The HTML file (index.html) contains the structure of the weather dashboard, including input fields for searching locations and placeholders for displaying weather data. CSS

The CSS file (styles.css) contains styles for the weather dashboard, including the animated cloud background. JavaScript

The JavaScript file (script.js) contains the logic for fetching and displaying weather data. Key functions include:

  1. fetchWeatherData(location): Fetches weather data for the specified location.
  2. updateCurrentWeather(data): Updates the current weather section with fetched data.
  3. updateForecast(data): Updates the forecast section with fetched data.
  4. getLocation(): Uses the Geolocation API to get the user's current location and fetch weather data for it.

Example

Below is a basic example of how to use the weather dashboard:

Open the index.html file in your browser. By default, it will display weather information for your current location. To search for another location, enter the city name and click "Search".

Contributing

Contributions are welcome! Please open an issue or submit a pull request if you have any improvements or bug fixes. License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgements

OpenWeatherMap for providing the weather data API.

weather_dashboard's People

Contributors

sufyan14 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.