Skip to content

Preloading set of images per trial #724

Discussion options

You must be logged in to vote

Before a trial with images, or a block of trials, you can use the call-function plugin to preload the images. I'm using getDisplayElement() and pluginAPI.preloadImages()

var images = ["image1.png", "image2.png"]

var trial = {
  type: "call-function",
  async: true,
  func: function(done) {
    jsPsych.getDisplayElement().innerHTML = '<p>Loading... Please wait.</p>'
    jsPsych.pluginAPI.preloadImages(images, function() {
      done({ preload: "success" });
    })
  }
};

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@vijaymarupudi
Comment options

@NadineDijkstra
Comment options

@NadineDijkstra
Comment options

@vijaymarupudi
Comment options

@NadineDijkstra
Comment options

Answer selected by NadineDijkstra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants