(function($){
$.extend($.fn,{
color:function(options)
{
var options=$.extend({bcolor:"white",fcolor:"black"},options);
return this.each(function(){
$(this).css("color",options.bcolor);
$(this).css("color",options.fcolor);
});
}
})
})(jquery);
$.extend($.fn,{
color:function(options)
{
var options=$.extend({bcolor:"white",fcolor:"black"},options);
return this.each(function(){
$(this).css("color",options.bcolor);
$(this).css("color",options.fcolor);
});
}
})
})(jquery);
$(this).css("color",options.fcolor);
这两句话都是改文本颜色 第一个应该改背景颜色吧? background-color调用:
$("#t").color({
bcolor:"red",fcolor:"green"
});
IE9 火狐下测试没问题:
引用库
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
代码:(function($){
$.extend($.fn,{
color:function(options){
var options=$.extend({bcolor:"white",fcolor:"black"},options);
return this.each(function(){
$(this).css("background",options.bcolor);
$(this).css("color",options.fcolor);
});
}
})
})(jQuery);
$(function(){
$("#t").color({
bcolor:"red",fcolor:"white"
});
});