Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Add Colors in questions

More
4 years 4 weeks ago #195886 by Filippo_nov
Replied by Filippo_nov on topic Add Colors in questions
Thank you!
It works perfectly!
The topic has been locked.
More
3 years 9 months ago #202476 by elisam05
Replied by elisam05 on topic Add Colors in questions
Hello,

I'm using Limesurvey professional 3.22.9.

I used the following code that you previuosly suggested to set the background colors in the dual scale array:

<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:scriptcomplete',function(){
$('.coloured-array.array-flexible-duel-scale').each(function(i) {
// Assign column-specific classes
$('table.subquestion-list tr.ls-heading:not(.groups)', this).each(function(i) {
$('.answer-text', this).each(function(i){
$(this).addClass('column-'+(i+1));
});
});
});
});
</script>[/i
]

<style type="text/css">
.coloured-array.array-flexible-duel-scale .column-1 { background-color: #FF9B57;} /* Orange */
.coloured-array.array-flexible-duel-scale .column-2 { background-color: #F4F781;} /* Yellow*/
.coloured-array.array-flexible-duel-scale .column-3 { background-color: #53C170;} /* Green*/
.coloured-array.array-flexible-duel-scale .column-4 { background-color: #FF9B57;} /* Orange */
.coloured-array.array-flexible-duel-scale .column-5 { background-color: #F4F781;} /* Yellow*/
.coloured-array.array-flexible-duel-scale .column-6 { background-color: #53C170;} /* Green*/
.coloured-array.array-flexible-duel-scale .column-7 { background-color: #FF5B5B;} /* Red*/
</style>


It works perfectly but it only sets the color of the header. Is there a way to change the color of the entire colums in the dual scale array, including also the answer cells?
I attach a picture of the result I'd like to obtain.

Just to notice, in the previous topic conversation there was also an example for the single scale array: that works great to change the color of the entire columns, but I can't use it for the dual scale array.



Thank you for the attention
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 9 months ago - 3 years 9 months ago #202481 by Joffm
Replied by Joffm on topic Add Colors in questions
Hi,

I added this to the css
Code:
    td.answer_cell_1_A1 {  background-color: #FF9B57;}
    td.answer_cell_1_A2 {  background-color: #F4F781;}
    td.answer_cell_1_A3 {  background-color: #53C170;}
    td.answer_cell_2_A1 {  background-color: #FF9B57;}
    td.answer_cell_2_A2 {  background-color: #F4F781;}
    td.answer_cell_2_A3 {  background-color: #53C170;}



In this example the answer options are coded "A1", "A2", ...
If you use other codes you have to adapt.

You see that you might use slightly different colors than the header - whatever you like.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 years 9 months ago by Joffm.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
More
3 years 9 months ago #202483 by elisam05
Replied by elisam05 on topic Add Colors in questions
Thank you so much for your answer!

Would you mind showing me also the JavaScript code you used to codify the answer options as A1, A2, etc. ?
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 9 months ago #202484 by holch
Replied by holch on topic Add Colors in questions
This has nothing to do with Javascript. It is the answer and subquestion codes that you gave to your question when you created it.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 9 months ago #202485 by Joffm
Replied by Joffm on topic Add Colors in questions
Did you ever enter answer options? ;)


Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
More
3 years 9 months ago #202486 by elisam05
Replied by elisam05 on topic Add Colors in questions
Okey I definitely thought it was more complex than this!
I used JavaScript to color the backgrounds in the single scale array and it worked , but it was simply an excessive effort!

Thank you both so much!
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose