Hello,
Using information from previous posts (JS and css), I have coded an operational clickable image slideshow with 5 images. My code in JS is the following:
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
var prevBtn = document.querySelector(".prev");
var nextBtn = document.querySelector(".next");
var slides = document.querySelectorAll(".mySlides");
var slideIndex = 1;
showDivs(slideIndex);
function plusDivs(n) {
showDivs(slideIndex += n);
}
function showDivs(n) {
var i;
var x = document.getElementsByClassName("mySlides");
if (n > x.length) {slideIndex = 1}
if (n < 1) {slideIndex = x.length} ;
for (i = 0; i < x.length; i++) {
x;i].style.display = "none";
}
xlslideIndex-1].style.display = "block";
}
// Event listener for the previous and next buttons
prevBtn.addEventListener("click", function() {
plusDivs(-1);
});
nextBtn.addEventListener("click", function() {
plusDivs(1);
});
});
I want to ask respondents a series of questions relating to the images. However, I want to reveal these questions only after they have viewed ALL 5 images. Is there a way to modify the above code to record whether all 5 images have been displayed, which I could then import as an embedded data? Or the number of images displayed? Thanks!