I have not tested this, but something like this should work:
First create 2 placeholders for the images:
<div id="image-container">
<img src="image1.jpg" id="image1">
<img src="image2.jpg" id="image2">
</div>
Then use CSS to hid the second image:
<style>
#image2 {
display: none;
}
</style>
And finally use Javascript to make the change:
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
setTimeout(function() {
document.getElementById('image1').style.display = 'none';
document.getElementById('image2').style.display = 'block';
}, 500); // Change this value to adjust the duration of each image
});
Hi @davetannenbaum ,
Just to add in @JesperAndersen code , add another interval function set the display none for second image after 2 sec has elapsed:
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
setTimeout(function() {
document.getElementById('image1').style.display = 'none';
document.getElementById('image2').style.display = 'block';
setTimeout(function() {
document.getElementById('image2').style.display = 'none';
}, 2000); // Hide image2 after 2 seconds
}, 500); // Change this value to adjust the duration of each image
});
One more thing , is this for only two images or you will be showing all 50 images at 2 sec intervals??
Hope this resolves your query!!
Many thanks @JesperAndersen and @qualtrics_nerd, this is extremely helpful.
To your question @qualtrics_nerd, yes I was hoping to show all 50 images at 2 second intervals (so Image 1 stays the same each time, but Image 2 cycles through all 50 images). Long study, I know.
Is it possible to do this using loop & merge? The code you and Jesper provided works great when both Image 1 and Image 2 are linked directly to an image. But when I try to pipe-in a link to Image 2 (using Loop & Merge) it breaks. Any thoughts?
Just a follow-up, I was able to get it to work using Loop & Merge by removing the <div> tags inside the Loop & Merge (so that way it pipes in the url with nothing else). Many thanks to both of you for all of your help, I really appreciate it!
Many thanks @JesperAndersen and @qualtrics_nerd, this is extremely helpful.
To your question @qualtrics_nerd, yes I was hoping to show all 50 images at 2 second intervals (so Image 1 stays the same each time, but Image 2 cycles through all 50 images). Long study, I know.
Is it possible to do this using loop & merge? The code you and Jesper provided works great when both Image 1 and Image 2 are linked directly to an image. But when I try to pipe-in a link to Image 2 (using Loop & Merge) it breaks. Any thoughts?
Hi @davetannenbaum ,
Yes ,I will recommend you to use automated Slideshow where you can set the time interval by which it will loop through all the images. See below example
Slideshow
Hope this resolves your query!!
Very cool, many thanks @qualtrics_nerd!