jQuery插件开发方法

1. 通过$.extend()来扩展jQuery;

$.extend({
  sayHello:function(){
      console.log("Hello");
   }
})
$.sayHello();

2. 通过$.fn 向jQuery添加新的方法;

$.fn.blue = function(){
   this.css('background-color','blue');
}
$("div").blue();
$("body").blue();

3. 通过$.widget()应用jQuery UI的部件工厂方式创建。

原文地址:https://www.cnblogs.com/leiting/p/7412035.html