(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($);就会改变字体颜色 为红色!

 

posted on 2016-03-18 10:30  前端小菜j  阅读(176)  评论(0编辑  收藏  举报