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.

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.

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 GitHub

What it is

The full explanation is in README.md.

Good for

  • Product photos
  • Maps
  • Artwork
  • Detailed plans

Avoid on

  • Small or plain pictures