[英]Jquery datatable with tri color rows
我尝试了三色行的jquery数据表,它重复交替。但我只有两个彩色的行重复。
尝试使用三色行的jquery数据表
我正在使用属性偶数/奇数来着色
$(document).ready(function() {
$('#example').dataTable();
} );
$(document).ready(function() {
$("#example tr:even").css("background-color", "LightYellow");
$("#example tr:odd").css("background-color", "LightBlue");
});
您不必使用jquery来实现此CSS非常适合该作业。 试试这个。
/*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.