Using The API Example

Using gallery API is very easy. You have some functions that can control the gallery functions and some events that happends on gallery states change. Below there is examples of some of the functions that you can call with a button click.
For more detailed explanation you can read the documentation.

That way you are calling the functions: <script type="text/javascript"> var api; jQuery(document).ready(function(){ api = jQuery("#gallery").unitegallery(); }); </script> <!-- Using the API call from the button below --> <input type="button" value="Next Item" onclick="api.nextItem()" > * Note, that the api variable has to be global variable, outside the oneady() function scope.

API Functions available: //start play mode api.stop() //stop play mode api.togglePlay() //toggle play mode api.enterFullscreen() //enter fullscreen api.exitFullscreen() //exit fullscreen api.toggleFullscreen() //toggle fullscreen api.zoomIn() //zoom in current image api.zoomOut() //zoom out current image api.resetZoom() //reset zoom to fit zoom mode api.nextItem() //next item api.prevItem() //previous item api.selectItem(numItem) //go to some item by index (0-numItems) api.resize(width, height) //resize the gallery to some width. Height is optionary. api.getItem(numItem) //get data object of the item by some index. api.getNumItems() //get number of items in the gallery
API Events available: api.on("item_change",function(num, data){ //on item change, get item number and item data //do something }); api.on("resize",function(){ //on gallery resize //do something }); api.on("enter_fullscreen",function(){ //on enter fullscreen //do something }); api.on("exit_fullscreen",function(){ //on exit fulscreen //do something }); api.on("play",function(){ //on start playing //do something }); api.on("stop",function(){ //on stop playing //do something }); api.on("pause",function(){ //on pause playing //do something }); api.on("continue",function(){ //on continue playing //do something });