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

相關文章
相關標籤/搜索