EasyZoom Documentation

EasyZoom converts an image with parent link into an interactive zoom. To start you will need to include a recent version of jQuery (greater than 1.7) and either easyzoom.js for development or easyzoom.min.js for production.

HTML

The plugin does not rely on a specific HTML structure but the following markup is a sensible start:

<div class="zoom-container">
	<a id="zoom-target" href="photos/zoom.jpg">
		<img class="zoom-image" src="photos/normal.jpg" alt="" width="390" height="520" />
	</a>
</div>
CSS

Some basic CSS is necessary to ensure correct display and positioning of the enlarged image. An expanded and fully commented example is included within easyzoom.css.

/* Zoom parent */
.zoom-container {
	position:relative;
}

/* Image to zoom */
#zoom-target {
	position:relative; /* Not strictly necessary but useful for positioning the loading message */
	display:block; /* This is very important, the element must have metrics to provide an area to catch events */
}
	#zoom-target .fullsize-loading {
		position:absolute;
		z-index:150;
	}

/* Zoom panel */
#zoom-panel {
	position:absolute;
	top:0;
	left:410px;
	width:390px;
	height:520px;
	overflow:hidden;
	background:#fff;
	z-index:200;
}
Javascript

To activate the plugin pass an HTML element or selector into the jQuery factory function and call the easyZoom() method upon it.

$('#zoom-target').easyZoom();
Options

To help EasyZoom fit easily into your website there are a number configurable options to adjust the plugin structure and appearance. The available options (and their defaults) are below:

var options = {
	id: 'zoom-panel',
	parent: 'body',
	error: '<p class="zoom-error">There has been a problem attempting to loading the image.</p>',
	loading: '<p class="fullsize-loading">Loading</p>',
	cursor: 'crosshair',
	touch: true
};
id
The ID attribute to assign the zoom panel
parent
Parent element selector to append zoom panel to
error
HTML to display within the zoom panel if an error occurs loading large image
loading
HTML to append and display to the zoom target while loading the large image
cursor
Specify cursor display when interacting with easyZoom
touch
Enable touch events when available