Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Not sure if this is exactly what you're looking for, but here's a solution using jQuery and CSS. This will be a better cross-browser solution as CSS :nth-child isn't supported by all major browsers yet.</p> <p>jQuery:</p> <pre><code>//Add group classes to rows $('table.table_database_edit tr').each(function () { if ($('.table_database_edit tr').index($(this)) + 1 !== 1 &amp;&amp; ($('.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'); } }); //Highlight groups of two $('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'); }); </code></pre> <p>CSS: </p> <pre><code>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; } </code></pre> <p>Let me know if you need me to tweak it!</p> <p>Complete Solution: <a href="http://jsfiddle.net/rqJAY/9/" rel="nofollow">Updated JSFiddle - Unlimited Grouping</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload