zoom: function ( element, scale ){.....},
init: function() {
$("#book div img").live('dblclick', function() {
...
$( "#slider" ).slider({
...
slide: function( event, ui ) {
//call function here
zoom (element,ui.value);
}
});
});
},
There are two function, zoom and the main function. The main function call zoom function to perform work, how ever, since it is not at the same level, the browser return the error of undefined function ‘zoom’ . How to fix this (Able to call zoom inside the slide:function)?
Store a reference to the
thisobject in the outermost scope of your functions. Then callthis.zoom()inside your callback:simplified example: http://jsfiddle.net/u5ZL3/