Skip to content

Hover and keyboard image zoom

A product photo that zooms in under the pointer, and from the keyboard with Enter and the arrow keys, to inspect the details.

  • Tailwind
  • React
  • CSS
  • WordPress
Open in a new tab

Description

On a product page, customers want to see the material and finish up close. On mouse hover, the photo zooms in two and a half times around the pointed spot and follows the pointer. The zoom does not depend on the mouse: the photo is a button (aria-pressed) described by visible help text; Enter or a click locks the zoom, the arrow keys move it in 10 % steps, Escape returns to the full view. On touch screens, a tap toggles the zoom. The photo keeps its description for screen readers, nothing animates and the zoom stays within its frame, with no horizontal scrolling from 360 px. Photo and details side by side, then stacked on phones. AA contrast in light and dark mode, visible focus. Example: a cast-iron teapot from a tableware shop.

Code

Loading the code…

The code of this component in

Archive contents

galerie-zoom-survol-html-tailwind.zip3 files · 5 Ko

  • index.html5 Ko
  • README.md3 Ko
  • LICENSE.md1 Ko

Tags

Updated on December 2, 2026.

Reviews

No reviews yet.

In the same spirit

  • Building site photos sorted by dated step on a vertical timeline, with the current step highlighted.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • YouTube videos shown as thumbnails: the player only loads on click, to respect privacy and keep the page light.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component