I am looking for a better way to access/manage data inside a plugin callback function. I want to do the same thing as the jQuery UI.
UI example:(how I want to do this) http://api.jqueryui.com/sortable/
$( ".selector" ).sortable({
activate: function( event, ui ) {
alert(ui.item)
alert(ui.position)
alert(ui.offset)
}
});
my plugin example(how I now have it):
$( ".selector" ).myplugin({
activate: function( event, item, postion, offset ) {//to much parameters
alert(item)
alert(position)
alert(offset)
}
});
//inside the plugin
var varItem = '';
var varPosition = '';
var varOffset = '';
if(typeof self.o.activate == 'function'){
self.o.activate.call(this, varItem, varPosition, varOffset);
}