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插件开发
最新推荐文章于 2024-01-05 19:47:22 发布