Using unique page timer for randomized questions? | XM Community
Skip to main content
Solved

Using unique page timer for randomized questions?

  • November 3, 2018
  • 1 reply
  • 19 views

I have a survey that involves showing participants images for a certain number of seconds. Each image should be shown for a unique amount of time, e.g. image1 for 2 seconds, image2 for 5 seconds, image3 for 1 second. I want each page to show only one image and I want to randomize the order of images. I tried using the setTimeout function, but when I add page breaks and randomize the questions it only shows one image in my block. How would I fix this, or do it differently to make it work?

Best answer by TomG

You can use a loop & merge block with the image urls and timeouts as loop & merge fields. Pipe the url field into a src attribute in an html img tag. Pipe the timeout field into your JavaScript. Randomize the loop.

1 reply

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • Answer
  • November 4, 2018
You can use a loop & merge block with the image urls and timeouts as loop & merge fields. Pipe the url field into a src attribute in an html img tag. Pipe the timeout field into your JavaScript. Randomize the loop.