我正在关注的JQuery Plugins/Authoring教程,并行和意味着无法弄清楚什么arguments
。我错过了一些真正的根本吗?jQuery插件教程解释
(function($){
var methods = {
init : function(options) {
// ...
},
show : function() {
// ...
};
$.fn.tooltip = function(method) {
// Method calling logic
if (methods[method]) {
return methods[ method ].
apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || ! method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist on jQuery.tooltip');
}
};
})(jQuery);
谢谢。
btw,是否有无论如何显示自动代码行号?谢谢。 – xcorat 2013-05-02 14:52:15
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Functions_and_function_scope/arguments – jbabey 2013-05-02 14:52:51
给您的评论,没有。使用线内评论 – 2013-05-02 14:52:57