Alternating Slider Answer Colors | XM Community
Solved

Alternating Slider Answer Colors

  • 21 January 2021
  • 2 replies
  • 30 views

Hello there!
I am trying to add alternating grey and white backgrounds to my slider answer options. I found this existing community question relating to matrix tables, and I was wondering if there was a way to edit the CSS to make this work for the slider question option within the platform. When asking a question with multiple measures, the lack of alternating colors makes the answers hard to differentiate from each other. Any help would be greatly appreciated!! I have attached an image of how the slider questions currently look. I would like to add alternating grey/white background color within each different answer option.
User:

icon

Best answer by ahmedA 22 January 2021, 11:21

View original

2 replies

Userlevel 7
Badge +21

You can use the following code to set a different background colour for alternate choices:
sc = document.querySelectorAll(".slider-container:nth-child(odd)");
sc.forEach(item => item.style.backgroundColor = "#cccccc");
Or you could also add the same thing to CSS.

Ahmed, this work perfectly! Thank you so much!!

Leave a Reply