(function() {
$.fn.TestPlugin = function(){
var options = arguments;
var method = args[0];
var args = Array.prototype.slice.call(options, 1);
method.apply($(this),args);
}
var methods = {
setWidth: function(width) {
$(this).width(width)
}
}
})()
调用: