|
| 1 | +# 🌤️ Weather App |
| 2 | + |
| 3 | +A modern, responsive weather application that provides real-time weather information for any city worldwide. Built with vanilla JavaScript, HTML, and CSS, this app features an elegant glassmorphism design with integrated time display and geolocation support. |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +## ✨ Features |
| 8 | + |
| 9 | +### 🔍 **Weather Search** |
| 10 | +- Search weather information for any city worldwide |
| 11 | +- Real-time weather data from OpenWeatherMap API |
| 12 | +- Temperature display in Celsius with "feels like" temperature |
| 13 | +- Weather condition icons and descriptions |
| 14 | +- Error handling for invalid city names |
| 15 | + |
| 16 | +### 📍 **Geolocation Support** |
| 17 | +- Get weather information for your current location |
| 18 | +- One-click location detection using browser's geolocation API |
| 19 | +- Automatic weather update based on GPS coordinates |
| 20 | + |
| 21 | +### ⏰ **Live Time Display** |
| 22 | +- Real-time digital clock with 12-hour format |
| 23 | +- Current date display with day, date, and month |
| 24 | +- Updates every second for accurate time keeping |
| 25 | + |
| 26 | +### 🎨 **Modern UI/UX** |
| 27 | +- Glassmorphism design with backdrop blur effects |
| 28 | +- Responsive design that works on all device sizes |
| 29 | +- Beautiful background imagery |
| 30 | +- Smooth animations and transitions |
| 31 | +- Font Awesome icons for enhanced visual appeal |
| 32 | + |
| 33 | +### 🌐 **Location Display** |
| 34 | +- Shows current city and country information |
| 35 | +- Updates dynamically based on search or geolocation |
| 36 | + |
| 37 | +## 📁 Project Structure |
| 38 | + |
| 39 | +``` |
| 40 | +05-Weather-App/ |
| 41 | +├── index.html # Main HTML structure |
| 42 | +├── style.css # Styling and responsive design |
| 43 | +├── script.js # JavaScript functionality |
| 44 | +├── README.md # Project documentation |
| 45 | +└── img/ |
| 46 | + ├── bg.jpg # Background image |
| 47 | + └── favicon/ # Favicon files |
| 48 | + ├── apple-touch-icon.png |
| 49 | + ├── favicon-32x32.png |
| 50 | + ├── favicon-16x16.png |
| 51 | + └── site.webmanifest |
| 52 | +``` |
| 53 | + |
| 54 | +## 🛠️ Technologies Used |
| 55 | + |
| 56 | +- **HTML5**: Semantic markup and structure |
| 57 | +- **CSS3**: Modern styling with Flexbox, glassmorphism effects |
| 58 | +- **Vanilla JavaScript**: Core functionality and API integration |
| 59 | +- **OpenWeatherMap API**: Real-time weather data |
| 60 | +- **Font Awesome**: Icon library |
| 61 | +- **Google Fonts**: Typography (Poppins, Roboto) |
| 62 | +- **Geolocation API**: Browser location services |
| 63 | + |
| 64 | +## 📋 Prerequisites |
| 65 | + |
| 66 | +Before running this project, make sure you have: |
| 67 | + |
| 68 | +- Basic knowledge of **HTML5** |
| 69 | +- Basic knowledge of **CSS3** (Flexbox, responsive design) |
| 70 | +- Basic knowledge of **JavaScript** (ES6+, Fetch API, DOM manipulation) |
| 71 | +- Understanding of **API integration** |
| 72 | +- Knowledge of **Asynchronous JavaScript** (Promises, async/await) |
| 73 | + |
| 74 | +## ⚙️ Installation & Setup |
| 75 | + |
| 76 | +### 1. Clone the Repository |
| 77 | +```bash |
| 78 | +git clone https://github.com/ashishgit10/25-Javascript-Projects-for-beginner.git |
| 79 | +cd 25-Javascript-Projects-for-beginner/05-Weather-App |
| 80 | +``` |
| 81 | + |
| 82 | +### 2. Get OpenWeatherMap API Key |
| 83 | +1. Visit [OpenWeatherMap](https://openweathermap.org/api) |
| 84 | +2. Create a free account |
| 85 | +3. Generate your API key |
| 86 | +4. Replace the API key in `script.js`: |
| 87 | + ```javascript |
| 88 | + var key = "YOUR_API_KEY_HERE"; |
| 89 | + var key2 = "YOUR_API_KEY_HERE"; |
| 90 | + ``` |
| 91 | + |
| 92 | +## 🎯 How to Use |
| 93 | + |
| 94 | +### Search by City Name |
| 95 | +1. Type the city name in the search input field |
| 96 | +2. Click the "Search" button |
| 97 | +3. View the weather information displayed |
| 98 | + |
| 99 | +### Use Current Location |
| 100 | +1. Click the location icon (📍) next to the search bar |
| 101 | +2. Allow location access when prompted by the browser |
| 102 | +3. The app will automatically fetch weather for your current location |
| 103 | + |
| 104 | +### Features Display |
| 105 | +- **Time**: Shows current time in 12-hour format with AM/PM |
| 106 | +- **Date**: Displays current day, date, and month |
| 107 | +- **Location**: Shows city and country |
| 108 | +- **Temperature**: Current temperature and "feels like" temperature |
| 109 | +- **Weather**: Weather condition with appropriate icon |
| 110 | + |
| 111 | +## 🔧 API Integration |
| 112 | + |
| 113 | +This project uses the **OpenWeatherMap API** for weather data: |
| 114 | + |
| 115 | +### Endpoints Used: |
| 116 | +- **By City Name**: `https://api.openweathermap.org/data/2.5/weather?q={city}&appid={key}` |
| 117 | +- **By Coordinates**: `https://api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&appid={key}` |
| 118 | + |
| 119 | +### Data Retrieved: |
| 120 | +- Temperature (converted from Kelvin to Celsius) |
| 121 | +- Weather conditions and descriptions |
| 122 | +- Weather icons |
| 123 | +- Location information (city, country) |
| 124 | +- "Feels like" temperature |
| 125 | + |
| 126 | +## 🎨 Styling Features |
| 127 | + |
| 128 | +### Glassmorphism Design |
| 129 | +- Semi-transparent containers with backdrop blur |
| 130 | +- Border styling with dotted effects |
| 131 | +- Subtle shadows and overlays |
| 132 | + |
| 133 | +### Responsive Design |
| 134 | +- Flexible layouts using CSS Flexbox |
| 135 | +- Minimum width constraints for mobile compatibility |
| 136 | +- Scalable typography and spacing |
| 137 | + |
| 138 | +### Visual Elements |
| 139 | +- Background image with proper positioning |
| 140 | +- Weather condition icons from OpenWeatherMap |
| 141 | +- Font Awesome icons for UI elements |
| 142 | +- Custom color scheme with white text on dark overlay |
| 143 | + |
| 144 | +## 🔍 Code Structure |
| 145 | + |
| 146 | +### HTML (`index.html`) |
| 147 | +- Semantic HTML5 structure |
| 148 | +- Meta tags for responsive design and PWA support |
| 149 | +- Favicon integration |
| 150 | +- Clean, accessible markup |
| 151 | + |
| 152 | +### CSS (`style.css`) |
| 153 | +- Modern CSS with custom properties |
| 154 | +- Flexbox layouts for responsive design |
| 155 | +- Glassmorphism effects using backdrop-filter |
| 156 | +- Mobile-first responsive approach |
| 157 | + |
| 158 | +### JavaScript (`script.js`) |
| 159 | +- Modular function structure |
| 160 | +- Event-driven programming |
| 161 | +- Error handling for API calls and user inputs |
| 162 | +- Real-time clock functionality |
| 163 | +- Geolocation integration |
| 164 | + |
| 165 | + |
| 166 | +**Made with ❤️ for Hacktoberfest 2025** |
| 167 | + |
| 168 | +*Happy Coding! 🚀* |
0 commit comments