每天CookBook之JavaScript-083
- 将自己的代码库转换为JQuery插件
;(function ($) {
$.fn.flashBlueRed = function(){
return this.each(function(){
var hex = rgb2hex($(this).css("background-color"));
if(hex == "#0000ff"){
$(this).css("background-color", "#ff0000");
} else {
$(this).css("background-color", "#0000ff");
}
});
}
})(jQuery);