Background image for certain trials #1311
Unanswered
einGlasRotwein
asked this question in
Q&A
Replies: 1 comment
-
Hi Juli! Your second solution is correct, you just need to put the document.body.style.backgroundImage = 'url("./images/example.png")'; See here for the docs on setting style.backgroundImage. I hope that helps! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
how do I set background image for a certain trial type, say, only for the fixation screen. I was able to set a background image for the whole task based on this discussion. I am also able to change the background colour, e.g. during
on_finish()
of the previous trial usingdocument.body.style.background = '#000000';
or, alternatively:However, this does not work for images. If I use the image path (
document.body.style.backgroundImage = "./images/example.png";
), nothing happens at all. If I useurl()
on the path (which works fine if I use it as style in the body like in the discussion linked above;document.body.style.backgroundImage = url("./images/example.png");
), I get an error that the url is not defined.How do I change the background image dynamically?
Thank you in advance
Juli
Beta Was this translation helpful? Give feedback.
All reactions