Skip to content

Instantly share code, notes, and snippets.

@kaylarose
Created September 21, 2010 19:36
Show Gist options
  • Save kaylarose/590372 to your computer and use it in GitHub Desktop.
Save kaylarose/590372 to your computer and use it in GitHub Desktop.
//This will patch the jquery.iviewer plugin to accept a post-zoom callback function
//http://github.com/can3p/iviewer/issues/issue/1
/**
* event is triggered when zoom value is changed
* @param int new zoom value
* @return boolean if false zoom action is aborted
**/
onZoom: null,
//begin patch
/**
* event is triggered AFTER the image is zoomed
* @param int new zoom value
* @return void
**/
afterZoom: null,
//end
...
/**
* set image scale to the new_zoom
* @param new_zoom image scale in %
**/
set_zoom: function(new_zoom)
{
if(this.settings.onZoom && this.settings.onZoom.call(this, new_zoom) == false)
{
return;
}
......
this.current_zoom = new_zoom;
//begin patch
if($.isFunction(this.settings.afterZoom))
{
this.settings.afterZoom.call(this, new_zoom);
}
//end
this.update_status();
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment