- Source:
Methods
<static>simpleZoom(methodOrOptions)
A jQuery plugin for magnifying images.
Description
The SimpleZoom jQuery plugin creates a user controlled viewfinder element which is used to designate a region of the target image to be enlarged and then displayed within the plugins designated viewport element. By default the viewport and viewfinder are the same element creating the impression of a magnifying lens. Alternatively, a separate element may be specified as the active viewport.
Usage
Initializing the plugin
$("#selector").simpleZoom();
Initializing the plugin with options
The plugin may be invoked with an SimpleZoom~options object containing properties to override the defaults. The defaults may be accessed at jQuery.fn.simpleZoom.defaults.
$("#selector").simpleZoom({ zoom: 0.25 //set a 25% magnification });
Plugin Methods
The plugin exposes a collection of API methods for controlling it's behavior. There are two general ways to access these methods:
Once instantiated, a number of plugin methods become available to control the behavior of the plugin. For example, the SimpleZoom#option method may be used to set the plugins scale factor as follows:
$("#selector").simpleZoom( "option", // plugin method name "zoom", // first method argument 1.25 // second method argument );
Direct invocation
A reference to the plugin's underlying SimpleZoom instance is returned by the SimpleZoom#getSimpleZoom} method allowing for direct invocation of plugin methods.
$("#selector").simpleZoom("getSimpleZoom") .option("zoom", 0.25) //setter methods can be chained .setPosition(0, 0);
Notes
- If the plugin target is a collection of elements then the plugin is only applied to the first element.
- In order to function properly the plugin requires additional CSS included in the download package.
Parameters:
Name Type Argument Description methodOrOptions
string | SimpleZoom~options <optional> A method name or plugin options. - Source: