jquery插件开发

1. 类级别(类方法 或叫 静态方法)

	(function($){
		$.sayHello = function() {
			alert("Hello");
		}
	})(jQuery);

	调用: $.sayHello();

2. 对象级别

	(function($){
		$.fn.test = function() {
			alert("test");
		}
		
		$.fn.extend({
			test2 : function() {
			alert("test2");
			},
			test3 : function() {
				alert("test3")
			}
		});
	})(jQuery);

    调用: $("div").test() ;  $("div").test2();

你可能感兴趣的:(jquery插件开发)