easyui插件开发的基本结构 (function($) { $.fn.timeline = function(options) { if(typeof options == "string") { var params = []; for(var i = 1; i arguments.length; i++) { params.push(arguments[i]); } this.each(function() { $.fn.timeli
(function($) { $.fn.timeline = function(options) { if(typeof options == "string") { var params = []; for(var i = 1; i < arguments.length; i++) { params.push(arguments[i]); } this.each(function() { $.fn.timeline.methods[options].apply(this, params); }); return this; } options = options || {}; return this.each(function() { var data = $.data(this, "timeline"); var newOptions; if(data) { newOptions = $.extend(data.options, options); data.opts = newOptions; } else { newOptions = $.extend({}, $.fn.timeline.defaults, $.fn.timeline.parseOptions(this), options); $.data(this, "circle", { options: newOptions }); } var target = $(this); }); } $.fn.timeline.methods = { } $.fn.timeline.parseOptions = function(target) { return $.extend({}, $.parser.parseOptions(target, ["data", { data: "array" }])); }; $.fn.timeline.defaults = { data: [] } $.parser.plugins.push('timeline'); })(jQuery);