JQuery-based small plug-in _ jquery

Source: Internet
Author: User
A small plug-in based on jQuery that is used to change the color of the line and move the mouse to change the color. For more information about jquery, see. Table HTMLElement Effect

The Code is as follows:


Var br_cc = (function (){
Var setEffect = function (els, params ){
Var settings = {"c1": "# eee", "c2": "# ccc", "c3": "# f00 "};
$. Extend (settings, params );
Els. each (function (I ){
Var self = $ (this );
If (I % 2 = 0 ){
This. _ bg = settings. c1;
} Else {
This. _ bg = settings. c2;
}
Self.css ({"background-color": this. _ bg, "cursor": "pointer "});
Self. mouseover (function (){
Self.css ("background-color", settings. c3 );
});
Self. mouseout (function (){
Self.css ("background-color", this. _ bg );
});
});
};
Var cc_table = function (params ){
Params = params || {};
Var box = params. box? $ ("#" + Params. box): $ ("body"). eq (0 );
SetEffect (box. find ("tr "));
};
Var cc_p = function (params ){
Params = params || {};
Var box = params. box? $ ("#" + Params. box): $ ("body"). eq (0 );
Var els = params. tagClass? Box. find ("." + settings. tagClass): box. find ("p ");
SetEffect (els );
};
Return {"cc_tb": cc_table, "cc_p": cc_p };
})();
$ (Document). ready (function (){
Br_cc.cc_tb ({"box": "stu-datas-tb "});
Br_cc.cc_p ({"box": "stu-datas-p "});
});


It is very simple to use, so there will be no nonsense. If you need it, you can directly use it. Don't forget TOHA.
The data of table and p indicates the Html structure:

The Code is as follows:


Table HTMLElement Effect





















Id Name Age Sex
1 Zhang San 18 Male
1 Zhang San 18 Male
1 Zhang San 18 Male
1 Zhang San 18 Male

P HTMLElement Effect



1 Li Qian, 20 female



1 Li Qian, 20 female



1 Li Qian, 20 female



1 Li Qian, 20 female


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.