How is voat alternating background on comment reply?

2    26 Nov 2015 11:09 by u/Karmadilla

5 comments

1

I'm not sure how voat does it, but you could use css and nth-child(even) and (odd) to achieve this.

tr:nth-child(even) {background: #CCC}
tr:nth-child(odd) {background: #FFF}

from this link.

0
0

This sucks. I'm completely decoupled from back end. I'm using angular without any ASP MVC. So all my calls are API calls.

0

I am not really sure what you are trying to achieve, but the voat API returns all the comments as an array so as you iterate over the array you can decide what is even or odd and how you want to render them. If you are using a different API it would probably return data in a similar matter where you just decide what is even or odd in the front end.

0

It just took me a bit of time to sink in but I managed it using itsmemom97 suggestion, it works out well, http://jsfiddle.net/m7uW7/871/. I'm a bit slow when it comes to programming, even simple explanations take a little time to understand.