jquery 插件学习(四)

时间:2012-08-06    点击:66   
针对上面的示例,我们可以调用jquery.fn.extend()方法来创建jquery对象方法。具体代码如下》
复制代码 代码如下:

jQuery.fn.extend({
test : function(){
return this.each(function(){
alert(this.nodeName);
})
}
});

调用跟上面一样哦
复制代码 代码如下:

$('body *').click(function(){
$(this).test().html(this.nodeName).hide(1000);
});

到这里,已经介绍了写jquery插件的两种方法,jquery.extend() 和jquery.fn.extend(),你学会了吗。
深入理解javascript学习笔记(一) 编写高质量代码
JS数学函数Exp使用说明
基于jQuery的简单九宫格实现代码
jquery 插件学习(六)
jquery 插件学习(五)
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 Product All Rights Reserved