每天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);
posted @ 2016-07-27 22:35  4Thing  阅读(95)  评论(0编辑  收藏  举报