jQuery 封装function
写法2/** * @jQuery Active * @Create 03/26/1011 * @Use function $('#box').funname({item1:'', item2:''});*/(function($){$.FunName = function ($ele, options){this.options = options;alert(this.options.item1);}$.fn.funname = function(options){if (typeof options === 'string') { options = { url: options }; }var o = $.extend({},$.fn.funname.defaults,options);this.each(function(){$this = $(this);var FN = new $.FunName($this, o);$this.data('funname', FN);});//元素操作}$.fn.funname.defaults = {item1:'',item2:''};//设置传参})(jQuery);