Skip to content

mim515/QR-Code-Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

QR Code Generator

A simple web app that generates QR codes from user input. Enter any text or URL, click the button, and a QR code appears. Attempting to generate with an empty input triggers a shake animation.

πŸ“¦ Demo

Live Demo β†’ QR Code Generator

πŸ› οΈ Features

  • Generates a QR code using a free API
  • Supports text or URL input
  • Displays the generated QR image
  • Shake animation when input is empty
  • Clean, minimal UI

πŸ“ Project Structure

/ (root) β”œβ”€β”€ index.html β”œβ”€β”€ style.css β”œβ”€β”€ script.js β”œβ”€β”€ images/ β”‚ └── delete.png (if used) └── README.md

  • index.html β€” main HTML markup
  • style.css β€” styling and error animations
  • script.js β€” logic for QR generation, error handling
  • images/ β€” any image assets
  • README.md β€” this project documentation

πŸš€ How to Use

  1. Clone or fork the repository
  2. Open index.html in your browser
  3. Enter a text or URL in the input box
  4. Click Generate QR
  5. The QR code image will appear
  6. If input is empty, the input box shakes (error)

πŸ”§ Technologies Used

  • HTML
  • CSS (with keyframe animation for shake effect)
  • JavaScript (DOM manipulation, event handling)
  • QR Code API: https://api.qrserver.com/v1/create-qr-code/

🧩 How It Works (Overview)

  • The app takes input from a text field
  • If input length > 0:
    • Constructs the QR API URL with the input
    • Sets the src of an <img> to that URL, causing the QR image to load
    • Displays the image container
  • If input is empty:
    • Adds .error class to the input element
    • Uses CSS @keyframes to animate shake
    • Removes .error after a short delay so the animation can replay

πŸ“Œ Tips & Troubleshooting

  • Make sure input element’s ID matches in JS (qrText)
  • Use https:// in the API URL to avoid mixed content issues
  • In CSS, include units (e.g. translateX(-2px)) else transforms may not apply
  • To replay animation, remove and re-add .error class in JS

πŸ“¬ Contribution

Add more features like:

  • Downloading the QR image as PNG
  • Custom QR size input
  • Styling themes (dark mode, etc.)
  • Input validation (e.g. only URLs)

Contributions are welcome β€” fork the repo and submit a pull request!

πŸ“œ License

MIT License β€” feel free to use and modify the project as you like.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published