- Overview
- Documents
Zoomer is a jQuery plugin for smooth image exploration
Source: formstone.it
1. INCLUDE JS AND CSS FILES
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script src="js/jquery.fs.zoomer.js"></script> <link href="js/jquery.fs.zoomer.css" rel="stylesheet" type="text/css" media="all" />
2. HTML
<div class="zoomer_wrapper zoomer_basic"> <img src="http://formstone.it/files/demo/nasa-bw-1.jpg" /> </div>
3. JAVASCRIPT
$(".zoomer_basic").zoomer();
4. OPTIONS
Options are set by passing a valid options object at initialization or to the public "defaults" method. You can also set custom options for a specific instance by attaching a data-boxer-options attribute containing a properly formatted JSON object to the target element.
NAME | TYPE | DEFAULT | DESCRIPTION |
---|---|---|---|
callback | function | $.noop | |
controls.postion | string | "bottom" | Position of default controls |
controls.zoomIn | string | Custom zoom control selecter | |
controls.zoomOut | string | Custom zoom control selecter | |
controls.next | string | Custom pagination control selecter | |
controls.previous | string | Custom pagination control selecter | |
customClass | string | '' | Class applied to instance |
enertia | number | 0.2 | Zoom smoothing (0.1 = butter, 0.9 = sandpaper) |
increment | number | 0.01 | Zoom speed (0.01 = tortoise, 0.1 = hare) |
marginMin | |||
marginMax | |||
retina | boolean | false | Flag for retina image support |
source | string | object | null | Source image (string) or tiles (object) |
5. EVENTS
Events are triggered on the target instance's element, unless otherwise stated.
OPTION | DESCRIPTION |
---|---|
zoomer.loaded | Source media loaded |
6. METHODS
Methods are publicly available to all active instances, unless otherwise stated.
defaults
Sets default plugin options
$.zoomer("defaults", opts);
PARAMETER | TYPE | DEFAULT | DESCRIPTION |
---|---|---|---|
opts | object | {} | Options object |
destroy
Removes instance of plugin
$(".target").zoomer("destroy");
load
Loads source media
$(".target").zoomer("load", "path/to/image.jpg");
PARAMETER | TYPE | DEFAULT | DESCRIPTION |
---|---|---|---|
source | string | object | Source image (string) or tiles (object) |
pan
Pans plugin instances
$(".target").zoomer("pan", 50, 50);
PARAMETER | TYPE | DEFAULT | DESCRIPTION |
---|---|---|---|
left | int | Percentage to pan to (50 = half) | |
top | int | Percentage to pan to (50 = half) |
resize
Resizes plugin instange
$(".target").zoomer("resize");
unload
Unload image from plugins instances
$(".target").zoomer("unload");