jquery 简单插件

(function ($) {
$.fn.extend(
{
"wangjing":function(options){
var opts = $.extend(defaults,options);
this.each(function () {
var $this =$(this);
$this.css("color",opts.color);
})
}


}
);
//默认参数
var defaults = {
color: 'red'
};
})(window.jQuery);

这个插件就是 调用 $.wangjing($);就会改变字体颜色 为红色!

原文地址:https://www.cnblogs.com/qianduanxiaocaij/p/5291069.html