04.43 · Micro-Interactions
Magnifier Lens
A lens follows your pointer and shows the picture up close. Best for product photos.
Hover it
Point at the watch, drag a finger across it (or Tab to it and use the arrow keys), or press Show me.
Inside, the box is zoomed out: the picture sits over a faint, bigger copy of itself. The lens is a window onto that copy, which slides the other way as the lens moves.
On the left the lens stretches the small picture, so the detail blurs. On the right it shows a bigger copy, so the detail stays sharp.
Try it
Change a setting, then point at the watch or press Show me.
Zoom
How much bigger things look in the lens.
Lens size
A bigger lens shows more around the spot.
Lens shape
Square suits maps and plans.
Copy the prompt
Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.
Add a magnifier lens to [the product photo or detailed picture people want to inspect]. While the pointer is over the picture, show a lens there holding an enlarged copy, placed so the spot under the pointer sits in the middle of the lens. Fill the lens from a larger, sharper version of the picture, never the same small one stretched, and move the lens and the copy with transforms only. On touch screens, show it while a finger is down, just above the finger, and let a drag move it without scrolling the page; from the keyboard, show it on focus and move it with the arrow keys. If the visitor has reduced motion turned on, let it appear without growing. Match the settings listed below.
Your settings
Replace the words in brackets with your own element. Your settings are added at the end.
Free and open source. If this helped, a star on GitHub helps other people find it.
Star on GitHubWhat it is
The full explanation is in README.md.