Created
August 2, 2012 17:17
-
-
Save mynameispj/3238866 to your computer and use it in GitHub Desktop.
Zebra striping table rows, resetting on specific table rows...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('tbody > tr').each(function(){ | |
if ($(this).hasClass('header')) { | |
counter=1; | |
} else { | |
if (counter == 1) { | |
$(this).addClass('even'); | |
counter++; | |
} else if (counter == 2) { | |
$(this).addClass('odd'); | |
counter--; | |
} | |
} | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<tr> <!--want no class, as its a header, and also want to reset the zebra striping--> | |
<th colspan="2" class="header" > | |
<strong>Body type</strong> | |
</strong></td> | |
</tr> | |
<tr> <!--want class of 'even'--> | |
<td><strong>Body type</strong></td> | |
<td>Mid-size SLR</td> | |
</tr> | |
<tr> <!--want no class, as its a header, and also want to reset the zebra striping--> | |
<th colspan="2" > | |
<strong>Sensor</strong> | |
</strong></td> | |
</tr> | |
<tr> <!--want class of 'even'--> | |
<td><strong>Max resolution (px)</strong></td> | |
<td>7360 x 4912</td> | |
</tr> | |
<tr> <!--want class of 'odd'--> | |
<td><strong>Effective pixels</strong></td> | |
<td>36.3 | |
<span >megapixels</span> | |
</td> | |
</tr> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment