Jcrop » Thumbnail Demo

Aspect ratio with preview pane.

The most visual demo, the preview pane is accomplished entirely outside of Jcrop with a simple jQuery-flavored callback. This type of interface could be useful for creating a thumbnail or avatar. The onChange event handler is used to update the view in the preview pane.

Invocation Code:

		onChange: showPreview,
		onSelect: showPreview,
		aspectRatio: 1

When the selection is moved, this function is called:
function showPreview(coords)
	var rx = 100 / coords.w;
	var ry = 100 / coords.h;

		width: Math.round(rx * 500) + 'px',
		height: Math.round(ry * 370) + 'px',
		marginLeft: '-' + Math.round(rx * coords.x) + 'px',
		marginTop: '-' + Math.round(ry * coords.y) + 'px'
(updates pre-existing preview pane using jQuery css method)

These demos have been adapted for display on this website. Simplified versions of the same demos (with simplified source code) are included in the archive download.