/**
* Created by mr_yi on 2017/8/24.
*/
var a = 123;
(function($){
// 为 jquery 对象设置属性
$.fn.messager = {
alert:function(msg){
alert(msg);
},
confirm:function(msg){
confirm(msg);
}
};
//为 jquery 类本事设置 静态方法
$.extend({
alert:function(msg){
alert(a);
},
messager:{
alert:function(msg,fn){
console.debug(typeof fn);
console.debug(typeof fn === 'function');
if(typeof fn === 'function'){
fn.call();
}
}
}
});
}(window.jQuery));
jQuery 扩展实现
猜你喜欢
转载自blog.csdn.net/qq844579582/article/details/77524984
今日推荐
周排行