Add image under text in instruction #824
-
I tried to insert stimuli example image below the text in the second page of instruction, but always get a flash of something between the first instruction page that contains only the text, and the second instruction page that contains both the text and the images. I have no idea what that was that flashed through the display, and how to get rid of it. Could you please help? Thanks! My codes:
|
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 4 replies
-
I think this is because you're using an image in the instructions, and that image is not preloaded, so the flash/delay comes from the browser having to load the image before showing that page. Can you try adding this line to your jsPsych.init? preload_images: ['path_to_your_instructions_image'] |
Beta Was this translation helpful? Give feedback.
-
Another thing you can do is open your developer tools, then go to the 'network' tab. Ideally you want your instructions image to show up there when the page first loads, rather than when you get to the instructions page that contains the image. |
Beta Was this translation helpful? Give feedback.
-
Hmm. I've just tried this with the following code in Chrome, and I couldn't reproduce the problem: var instruction = {
type:'instructions',
pages:['text','another text' +'<image src="jspsych/examples/img/1.gif"></img>'],
show_clickable_nav:true
}
jsPsych.init({
timeline: [instruction],
preload_images: ['jspsych/examples/img/1.gif']
}) Can you confirm that this is what your code looks like, and that the image is definitely preloading for you? |
Beta Was this translation helpful? Give feedback.
-
Initially I placed "timeline: [instruction]" below "preload_images: ['jspsych/examples/img/1.gif']", and now I switched the two, the problem almost solved! Thanks so much! my codes: (
|
Beta Was this translation helpful? Give feedback.
-
I know what you mean where the text shows up normal and quickly changes to bold, however I can't seem to reproduce it on my end. So I'm not sure if this works, but can you try changing your pages:['<p>Your task is to find the target which is an <strong>octagon with a white cross inside</strong>, </p><p>and respond <strong>on which side the dot is</strong> by pressing the <strong>left or right arrow key</strong>.</p>'], It might be that the |
Beta Was this translation helpful? Give feedback.
Hmm. I've just tried this with the following code in Chrome, and I couldn't reproduce the problem:
Can you confirm that this is what your code looks like, and that the image is definitely preloading for you?