Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

Zoom on hover

6 sites No security coverage
View on drupal.org

This module enhances Drupal image fields with a high-performance JavaScript zoom effect. It allows users to magnify images using their mouse wheel or touch gestures and offers an optional fullscreen mode.

The Zoom on Hover module transforms standard Drupal image fields into a high-performance, interactive viewing experience for Drupal 10 and 11. Unlike older solutions, it is powered entirely by a custom JavaScript engine with zero third-party library dependencies (no jQuery, no xzoom.js). This ensures a lightweight footprint, lightning-fast load times, and maximum compatibility with modern decoupled or traditional Drupal themes.

Key Features

  • Custom JS Engine: Built from the ground up with vanilla JavaScript for superior performance and zero dependency overhead.
  • Scroll-to-Zoom: Interactive magnification control using the mouse wheel, supporting levels from 1× to 10×.
  • Native Touch Support: Smooth, flick-free zooming for mobile and tablet users via native touch-move event handling.
  • Click to Fullscreen: An optional built-in lightbox overlay featuring hardware-accelerated CSS animations.
  • GPU-Optimized: Utilizes translate3d and will-change CSS properties to ensure a consistent 60 fps rendering experience.

Installation

Install the module via Composer to ensure the codebase is properly structured within your Drupal project:

composer require drupal/zoom_on_hover

Enable the module using Drush:

drush en zoom_on_hover -y

Configuration

The module provides a field formatter that can be applied to any standard Image field:

  1. Navigate to Structure » Content types » [Your Type] » Manage display.
  2. Locate your image field and change the Formatter to Zoom on Hover.
  3. Click the gear icon on the right to configure the zoom mode, lens dimensions, and animation speeds.
  4. Save the display settings.

Zoom Modes

Choose the visual style that best fits your site's aesthetic:

  • Box: Displays an external preview panel beside the thumbnail. A tracking lens follows the cursor on the original image.
  • Circle: A classic circular magnifying glass effect overlaid on the image with a subtle darkened background.
  • Inside: A rectangular magnifier lens that reveals the zoomed-in details directly within the lens boundaries.
  • Background: The image pans and scales fluidly in-place within its own container—no extra panels or lenses required.

Requirements & Compatibility

  • Drupal: 10.0+ or 11.0+.
  • Browser Support: Modern evergreen browsers (Chrome, Firefox, Safari, Edge).
  • Zero External Libraries: No manual downloading of JS files to the /libraries/ folder is required.

Upgrading from Legacy Versions

Previous versions of this module relied on xzoom.js. The current version removes this dependency to modernise the stack.

CSS Notice: If your theme contains custom CSS overrides for .xzoom, .xzoom-container, or .xzoom-preview, please update your selectors to .zoom-image, .zoom-container, and .zoom-preview respectively.

Similar Projects

Support & Contribution

If you find a bug or have a suggestion for a new feature, please submit an issue in the official queue. Contributions via Merge Requests are highly encouraged!

Activity

Total releases
1
First release
Feb 2026
Latest release
4 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Release date
1.1.3 Stable Feb 19, 2026