[英]Jquery datatable with tri color rows
I tried jquery datatable with tri colored rows which is repeating alternatively.But i got only two colored rows repeating. 我尝试了三色行的jquery数据表,它重复交替。但我只有两个彩色的行重复。
Tried jquery datatable with tri colored rows 尝试使用三色行的jquery数据表
I'm using property even/odd for coloring 我正在使用属性偶数/奇数来着色
$(document).ready(function() {
$('#example').dataTable();
} );
$(document).ready(function() {
$("#example tr:even").css("background-color", "LightYellow");
$("#example tr:odd").css("background-color", "LightBlue");
});
You don't have to use jquery to implement this CSS is much suitable for that job. 您不必使用jquery来实现此CSS非常适合该作业。 try this. 试试这个。
/*tri color rows*/
table.dataTable tbody tr:nth-child(3n+1) {background-color: #FFCCCC;}
table.dataTable tbody tr:nth-child(3n+2) {background-color: #99D6AD;}
table.dataTable tbody tr:nth-child(3n) {background-color: #EBD6FF;}
th {
background: #aaf;
}
thead{
background: #aaf;
}
/* End: tri color rows*/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.