diff --git a/index.html b/index.html index 28fcdac..543970f 100644 --- a/index.html +++ b/index.html @@ -435,10 +435,30 @@ }; function displayQuestion(questionId=1) { + currentQuestionId = questionId; + currentQuestionId = parseInt(currentQuestionId, 10); var questionContainer = document.getElementById('questionContainer'); questionContainer.classList.remove('show'); + var secondProgressSteps = document.querySelectorAll('.progress-tracker li:nth-child(2)'); + secondProgressSteps.forEach(function(firstProgressStep) { + if (currentQuestionId === 1) { + firstProgressStep.classList.remove('is-complete'); + } + if (currentQuestionId > 1) { + firstProgressStep.classList.add('is-complete'); + } + }); + var lastProgressSteps = document.querySelectorAll('.progress-tracker li:nth-child(3)'); + lastProgressSteps.forEach(function(lastProgressStep) { + if ([10, 11, 12, 13, 14, 15, 22, 23].includes(currentQuestionId)) { + lastProgressStep.classList.add('is-complete'); + } else { + lastProgressStep.classList.remove('is-complete'); + } + }); + setTimeout(function() { questionContainer.innerHTML = ''; var question = questions[currentQuestionId];