, , , , jQuery CSS. - CSS: nth-child .
JQuery
$('table.table_database_edit tr').each(function () {
if ($('.table_database_edit tr').index($(this)) + 1 !== 1 && ($('.table_database_edit tr').index($(this)) + 1) % 4 === 0) {
$(this).removeClass('groupOne').addClass('groupTwo');
$(this).prev().removeClass('groupOne').addClass('groupTwo');
} else {
$(this).addClass('groupOne');
$(this).next().addClass('groupOne');
}
});
$('table.table_database_edit tr').hover(function () {
if ($('.table_database_edit tr').index($(this)) === 0 || $('.table_database_edit tr').index($(this)) % 2 === 0) {
$(this).addClass('highlight');
$(this).next().addClass('highlight');
} else {
$(this).addClass('highlight');
$(this).prev().addClass('highlight');
}
}, function () {
$('.table_database_edit tr').removeClass('highlight');
});
CSS:
table.table_database_edit {
width: 100%;
border-collapse:collapse;
border-spacing: 0;
}
table.table_database_edit tr.groupOne {
background-color: #fff;
}
table.table_database_edit tr.groupTwo {
background-color: #EFF0F1;
}
table.table_database_edit tr.highlight {
background-color: yellow;
}
, , !
: JSFiddle -