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的部件工厂方式创建。

posted @ 2017-08-22 15:59  c-137Summer  阅读(169)  评论(0编辑  收藏  举报