A modern, glassy, and interactive webpage that demonstrates how to use JavaScript Event Handling to make web pages dynamic and engaging.
This project changes the background color to a random gradient when a button is clicked β and includes advanced event-handling examples for a professional frontend learning experience.
β
Click Event β Change background color to a random gradient
β
Double-Click Event β Reset to the original background
β
Mouseover & Mouseout β Neon glow animation on hover
β
Keydown Event (Spacebar) β Trigger color change using keyboard
β
Clipboard Interaction β Click the color text to copy gradient code
β
Dynamic Text Feedback β Displays the current color gradient
β
Glassy Neon UI β Smooth glassmorphism + gradient glow effects
β
Responsive & Modern Design β Works on all screen sizes
| Concept | Description |
|---|---|
addEventListener() |
Attaches multiple event handlers dynamically |
click event |
Handles button clicks for color change |
mouseover / mouseout |
Adds and removes glow effects on hover |
dblclick |
Resets background to the default |
keydown |
Detects the Space key press to trigger the same action |
navigator.clipboard.writeText() |
Copies the color gradient to clipboard |
Math.random() |
Generates random color values |
template literals |
Used for dynamic text and color display updates |
- π Glassy (Frosted Glass) look using
backdrop-filter: blur(20px) - π‘ Gradient neon glow animation for modern UI
- π¨ Dynamic background that updates smoothly with transitions
- π±οΈ Interactive hover, click, and key events for better UX
- π Minimal, elegant layout with Alfido Tech branding
| Technology | Purpose |
|---|---|
| HTML5 | Structure of the webpage |
| CSS3 | Glassmorphism, glow, and responsive styling |
| Vanilla JavaScript (ES6) | Event handling, DOM manipulation, and dynamic color generation |
- Clone or Download the Repository
git clone https://github.com/your-username/javascript-event-handling.git cd javascript-event-handling