The Star Zoom JavaScript API allows developers to interact with Star Zoom and add additional functionality.
You can create your own instances like this:
options = {}; // This would be your options object. $('#myViewport').StarZoom(options); // jQuery way. myInstance = new StarZoom($('#myViewport'),options); // 'normal' way.
You can get the Star Zoom instance that belongs to a particular viewport element:
myInstance = $('#myViewport').data('StarZoom');
Once an instance has been obtained, call methods like this:
myInstance.loadImage('/someImage'); myInstance.destroy();
Call static methods like this:
StarZoom.someStaticMethod();
Bind handlers to Star Zoom events like this:
$('#myViewport').bind('starzoom_ready',function(){alert('Star Zoom is ready!'});
Method Attributes | Method Name and Description |
---|---|
Test API call.
|
|
Removes all content within the viewport and
destroys the Star Zoom instance.
|
|
Returns the canvas element being used by the StarZoom instance. |
|
Returns the number of milliseconds Star Zoom has been idle,
that is, no movement or scaling.
|
|
Returns the opacity current opacity of the image.
|
|
Gets the x and y position of the image in the viewport.
|
|
Returns the current scale of the zoom image.
|
|
Clears the viewport and loads a zoomable image.
|
|
<static> |
StarZoom.
.quickStart
Auto starts Star Zoom, galleries and waypoints. |
<static> |
StarZoom.
.setAttr
Sets the attribute name to use for defining Star Zoom options in HTML. |
Sets a draw callback.
|
Event Attributes | Event Name and Description |
---|---|
<static> |
StarZoom.starzoom_ready()
Fired when an image has loaded succesfully.
|
Returns the canvas element being used by the StarZoom instance.
Only applicable for Canvas-enabled browsers.
Pans and zooms to the specfied position and scale, in specified time (milliseconds)
Auto starts Star Zoom, galleries and waypoints. It's just shortcut way of doing this:
$(".starzoom").StarZoom(); $(".starzoom-waypoint-set").StarZoomWaypoint(); $(".starzoom-gallery").StarZoomGallery();
Sets the attribute name to use for defining Star Zoom options in HTML.
Default is data-starzoom.
This can be useful when you don't want to use HTML5 style data attributes.
For instance, you could set the attribute name to 'rel' or 'onclick'
Field Attributes | Field Name and Description |
---|---|
The x value.
|
|
The y value.
|
var point = new StarZoom.point(x,y);