Welcome to the LimeSurvey Community Forum

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

progress bar multiple background color

  • swatib
  • swatib's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
2 years 7 months ago #226646 by swatib
Can i add multiple background colour on progress bar depend upon percentage completed?
Please suggest any idea..

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 7 months ago #226655 by tpartner
Replied by tpartner on topic progress bar multiple background color
LimeSurvey version?

Self hosted?

Survey theme used?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • swatib
  • swatib's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
2 years 7 months ago #226656 by swatib
Replied by swatib on topic progress bar multiple background color
limesurvey version- 5.3.6

theme- venus

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 7 months ago #226667 by tpartner
Replied by tpartner on topic progress bar multiple background color
1) Edit the theme progress_bar.twig file something like this:

Code:
{# do not show if : All in one or is not Y or on aCompleted #}
{% if aSurveyInfo.showprogress == 'Y' and aSurveyInfo.format != 'A' and not aSurveyInfo.aCompleted %}
    <!-- Top container -->
    <div class="{{ aSurveyInfo.class.topcontainer  }} space-col"  {{ aSurveyInfo.attr.topcontainer  }} >
        <div class="{{ aSurveyInfo.class.topcontent  }} container-fluid" {{ aSurveyInfo.attr.topcontent  }} >
            {% set progressValue  = ( aSurveyInfo.progress.total > 0 ) ? intval( (aSurveyInfo.progress.currentstep - 1) / aSurveyInfo.progress.total * 100 ) : 0 %}
      {% if progressValue|number_format > 66 %}
        {% set progressClass = 'high' %}
      {% elseif progressValue|number_format > 33 %}
        {% set progressClass = 'medium' %}
      {% else %}
        {% set progressClass = 'low' %}
      {% endif %}
            <div class="sr-only">{{ sprintf(gT('You have completed %s%% of this survey'),progressValue) }}</div>
                <div class="{{ aSurveyInfo.class.progress  }}" {{ aSurveyInfo.attr.progress  }}  aria-hidden="true">
                    <div class="{{ aSurveyInfo.class.progressbar  }} {{ progressClass }}" {{ aSurveyInfo.attr.progressbar  }} style="min-width: 2em; width: {{ progressValue }}%;">
                        {{ progressValue }}%
                    </div>
                </div>
        </div>
    </div>
{% endif %}

2) Add something like this to the end of your custom.css file:

Code:
.progress-bar.low {
  background-color: #FF0000;
}
.progress-bar.medium {
  background-color: #FFA500;
}
.progress-bar.high {
  background-color: #008000;
}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • swatib
  • swatib's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
2 years 7 months ago #226689 by swatib
Replied by swatib on topic progress bar multiple background color
yes its working ....thank you so much tpartner.

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose