Jquery Plugin 初学

今天尝试写了一下Jquery Plugin,算是Jquery 面向对象的一种this

 有几点心得url

1. $.fn 的用法,相似prototypeprototype

2.this 必须赋值给局部变量对象

3. extend的用法事件

4.如何绑定事件的用法io

$.fn.test = function (options) {
var settings = $.extend({
color: "dcdcdc",
url:"hello"function

}, options);test

var _oSelf = this;变量

this.click(function () {
alert(settings.color);
_oSelf.addClass("Green");
});

}cli

相关文章
相关标签/搜索