- Posts: 10251
- Thank you received: 3647
Ask the community, share ideas, and connect with other LimeSurvey users!
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Progress bar value $('#progress-wrapper').css('visibility', 'hidden'); setTimeout(function() { $('#progressbar').progressbar('value', 50 ); $('#progress-wrapper').css('visibility', 'visible'); }, 250); }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Progress bar value $('#progress-wrapper').css('visibility', 'hidden'); setTimeout(function() { $('#progressbar').progressbar('value', 50 ); $('#progress-wrapper').css('visibility', 'visible'); }, 250); }); </script>
tpartner wrote: To set the value of the core progress bar, you can do something like this:
Code:<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Progress bar value $('#progress-wrapper').css('visibility', 'hidden'); setTimeout(function() { $('#progressbar').progressbar('value', 50 ); $('#progress-wrapper').css('visibility', 'visible'); }, 250); }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { var progressValue = 32; $('.progress-bar').css({ 'transition': 'width 0s ease 0s', 'width': progressValue+'%' }).attr('aria-valuenow', progressValue).text(progressValue+'%'); }); </script>
tpartner wrote: That code is for previous versions of LimeSurvey. For the current version and the upcoming 3.x, use this code which applies to the Bootstrap progress bar.
Code:<script type="text/javascript" charset="utf-8"> $(document).ready(function() { var progressValue = 32; $('.progress-bar').css({ 'transition': 'width 0s ease 0s', 'width': progressValue+'%' }).attr('aria-valuenow', progressValue).text(progressValue+'%'); }); </script>
tpartner wrote: But...that's what LimeSurvey does automatically, so why bother with dynamically changing the progress value?
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { var QUESTIONS = 226; var progressValue = Math.round(({QUESTION_NUMBER}/QUESTIONS)*100); $('.progress-bar').css({ 'transition': 'width 0s ease 0s', 'width': progressValue+'%' }).attr('aria-valuenow', progressValue).text(progressValue+'%'); }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { var QUESTIONS = 226; var progressValue = Math.round(({QUESTION_NUMBER}/QUESTIONS)*100); $('.progress-bar').css({ 'transition': 'width 0s ease 0s', 'width': progressValue+'%' }).attr('aria-valuenow', progressValue).text(progressValue+'%'); }); </script>
It was fixed before for sure …tpartner wrote: I don't know of an automatic way to detect "currentQuestionNumber" that excludes hidden questions. LimeSurvey will return the question number with the {QUESTION_NUMBER} placeholder but that also includes hidden questions.