In the previous article, jquery implemented the full selection of checkbox and got some suggestions from friends. I did not know the definition of the plug-in, and I had a joke. Some friends suggested that I go to "sharp Jquery". to be honest, I am reading it. As I am learning, I want to write the jquery effect that is frequently used in projects as a general method. With your help, I can improve these methods, it also makes it impossible to understand a practice.
Create your own Jquery collections library for future use. These examples are self-written and have no reference. Therefore, there are many improvements to be made.
1: Why write this method?
In the project, you must set styles for some tables. To make the style beautiful, the header is a style, with an odd number of rows and an even number of rows. The color changes when the mouse passes, and the color is restored when the mouse leaves.
2: Implementation Process
Js file xs_table_css.js
xs_table_css = ; xs_table_th_css = ; xs_table_even_css = ; xs_table_odd_css = ; xs_table_select_css = ; xs_table = +).children().children().has().addClass(xs_table_th_css); tr_even = $().children().children().has(); tr_odd = $().children().children().has();
Sample file xs_table.css
----
Page file xs_table_css.htm
<! DOCTYPE html PUBLIC>
3: Method description
(1) You need to remove the previous css before mouseover and mouseout. Otherwise, style overlay will appear.
(2) Pay attention to tbody when searching for tr. Although there is no tbody tag on the page, this child element is used by default.
(3) To remove th from the odd and even lines, only find
4: The actual tableformat is set to. Zip.
Thank you for your correction. You have learned and made progress together.