A sleek and responsive weather dashboard built using HTML, CSS, and Vanilla JavaScript that provides real-time weather information and a 4-day forecast using the WeatherAPI service.
Designed with a modern glassmorphism UI, animated transitions, dynamic temperature visualization, and responsive layout support.
- 🔍 Search weather by city name
- 🌡️ Real-time temperature display
- 📅 4-day weather forecast
- 💧 Humidity information
- 💨 Wind speed tracking
- 🌡️ “Feels Like” temperature
- 📊 Animated temperature progress bar
- 🪟 Modern glassmorphism interface
- 🎞️ Smooth card reveal animation
- 📱 Responsive design for smaller screens
- 🌍 Country abbreviation support
⚠️ Beautiful alerts using SweetAlert2- 🖼️ Dynamic weather icons from API
| Technology | Purpose |
|---|---|
| HTML5 | Structure & layout |
| CSS3 | Styling, animations & responsiveness |
| JavaScript (ES6+) | API calls & DOM manipulation |
| WeatherAPI | Live weather & forecast data |
| SweetAlert2 | Stylish popup alerts |
| Tabler Icons | UI icons |
SkyWeather/
│
├── index.html # Main HTML structure
├── style.css # Main styling file
├── responsive.css # Responsive media queries
├── core.js # Main JavaScript logic
├── countrycode.js # Country abbreviation mapping
│
├── assets/
│ ├── snow.png
│ └── image.png
│
└── README.mdgit clone https://github.com/HafizEngineerMuhammadAbdullah/MyWeatherApp.gitMove into the project folder:
cd MyWeatherAppVisit:
- Create a free account
- Generate your API key
- Copy the key
Open core.js
Replace:
const apiKey = "your_api_key_here";with your real API key.
Simply open:
index.htmlin your browser.
No frameworks, build tools, or server setup required.
GET https://api.weatherapi.com/v1/forecast.json| Parameter | Description |
|---|---|
| key | Your WeatherAPI key |
| q | City name |
| days | Number of forecast days |
| Field | Description |
|---|---|
| current.temp_c | Current temperature |
| current.humidity | Humidity percentage |
| current.wind_kph | Wind speed |
| current.feelslike_c | Feels-like temperature |
| current.condition.text | Weather condition |
| current.condition.icon | Weather icon |
| forecast.forecastday | Multi-day forecast |
background: rgba(255,255,255,0.12);
backdrop-filter: blur(10px);Creates the frosted-glass modern dashboard effect.
Temperature values are converted into percentages and animated smoothly.
const percent = ((temp - min) / (max - min)) * 100;@keyframes slide-inUsed to smoothly reveal the weather dashboard after successful API fetch.
Weather cards slightly lift upward on hover for a modern UI feel.
transform: translateY(-3px);This project demonstrates practical usage of:
- Async/Await
- Fetch API
- DOM Manipulation
- Event Handling
- Array Iteration (
forEach) - Template Literals
- Functions
- Object Access
- Conditional Logic
- Dynamic Styling
- Error Handling with
try...catch
The project includes a separate responsive.css file for handling smaller screen sizes and improving mobile usability.
- Add dark/light mode toggle
- Add Celsius ↔ Fahrenheit switch
- Add weather search history
- Add sunrise & sunset timing
- Add geolocation support
- Add loading spinner
- Add hourly forecast
- Add weather background auto-change
This project is licensed under the MIT License.
- Weather Data by WeatherAPI
- Icons by Tabler Icons
- Alerts by SweetAlert2
- Fonts by Google Fonts
Created by Muhammad Abdullah GitHub
If you like this project:
- ⭐ Star the repository
- 🍴 Fork it
- 🛠️ Improve it
- 🚀 Share it with others
