Documentation Index
Fetch the complete documentation index at: https://mintlify.com/willnguyen1312/zoom-image/llms.txt
Use this file to discover all available pages before exploring further.
Overview
createZoomImageMove creates a zoom effect where the magnified image follows the cursor or touch pointer. The zoomed image is rendered as an overlay on the original image, creating a magnifying glass effect.
Function Signature
Parameters
The HTML element that contains the image to be zoomed. The function will automatically find the first
<img> element inside this container.Configuration options for the move zoom behavior.
The magnification factor for the zoomed image. A value of 4 means the image will be displayed at 4x its original size.
The URL of a higher-resolution image to display in the zoom view. Defaults to the source image’s
src attribute.If
true, disables the right-click context menu on the zoomed image. Useful for protecting image content on mobile devices.Deprecated. Previously controlled scroll locking behavior.
Return Value
Returns an object with the following methods:Removes all event listeners and the zoomed image element. Call this when the component unmounts or when zoom functionality is no longer needed.
Subscribe to state changes. The listener is called when the zoomed image loading status changes. Returns an unsubscribe function.
Get the current state including the zoomed image loading status.
State Types
ZoomImageMoveState
ZoomedImgStatus
Usage Examples
Basic Usage
With Custom Options
With High-Resolution Image
Disable Context Menu
Subscribe to Loading State
With Custom Styling
Product Gallery Implementation
With Loading Indicator
Features
- Follow cursor: Zoomed view follows mouse or touch pointer movement
- In-place zoom: Magnified image overlays the original image
- Lazy loading: High-resolution image loads only when user enters the image area
- Loading states: Track image loading progress
- Context menu control: Optionally disable right-click and long-press
- Auto-cleanup: Properly removes all elements and event listeners
- Touch support: Works with mouse, touch, and pen inputs
- Scroll lock: Automatically disables page scrolling on touch devices during zoom
Behavior
- Zoom activates when the pointer enters the container
- The zoomed image follows the pointer position
- Zoom boundaries are automatically calculated to keep the image within view
- Only one active pointer is tracked at a time (first pointer wins)
- Scroll is disabled on touch devices while zooming
- Scroll is re-enabled when pointer leaves or on touch end
Related Types
- ZoomImageMoveOptions - Options type for move zoom
Source Reference
Implementation:/packages/core/src/createZoomImageMove.ts:22