Skip to content

Instantly share code, notes, and snippets.

@jericrealubit
Last active May 28, 2018 22:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jericrealubit/c012649062bebeecf35cb6deb8439b1c to your computer and use it in GitHub Desktop.
Save jericrealubit/c012649062bebeecf35cb6deb8439b1c to your computer and use it in GitHub Desktop.
datatables alternate stripes
///+ Service Type Stripe
var cnt = 0;
$('td:first-child').each(function() {
if ($(this).text() != '') {
cnt++;
if (cnt % 2 == 0) {
var oTR = $(this).parent();
if (oTR.attr('class') == 'odd') {
var nx = oTR.css('background-color','#faf6e6');
} else {
var ny = oTR.css('background-color','#fffae0');
}
oTR.nextAll().each(function() {
if ($(this).find('td:eq(0)').text() == '' && cnt % 2 == 0) {
if ($(this).attr('class') == 'odd') {
$(this).css('background-color','#faf6e6');
} else {
$(this).css('background-color','#fffae0');
}
} else {
return false;
}
});
}
}
});
///- Service Type Stripe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment