- Posts: 8
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Add Colors in questions
- Filippo_nov
- Offline
- New Member
Less
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!
It works perfectly!
The topic has been locked.
- elisam05
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
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
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
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12940
- Thank you received: 3979
3 years 9 months ago - 3 years 9 months ago #202481
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Add Colors in questions
Hi,
I added this to the css
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
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.
- elisam05
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
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. ?
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11660
- Thank you received: 2742
3 years 9 months ago #202484
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
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
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12940
- Thank you received: 3979
3 years 9 months ago #202485
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Add Colors in questions
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- elisam05
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
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!
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.