Code Monkey home page Code Monkey logo

Comments (4)

mcfarla9 avatar mcfarla9 commented on July 4, 2024

Try replacing
<img id="distractor-image" src="{ $this.files[this.parameters.distractor] } /">
with either
<img id="distractor-image" src="{ $this.files[this.parameters.distractor] }" />
or even simply
<img id="distractor-image" src="{ $this.files[this.parameters.distractor] }">
(personally I prefer including the explicit "/>" to close the element, but that is a style issue).

from lab.js.

alexandrakirby avatar alexandrakirby commented on July 4, 2024

Thanks @mcfarla9, I have tried this both ways and I am still receiving the same issue:
image

Perhaps I am not defining the parameter properly? I have done this in the loop section where the main stimuli is defined:
image

from lab.js.

mcfarla9 avatar mcfarla9 commented on July 4, 2024

At this stage I would set aside the main project and work through some small demos in order to figure out how things work, then import what I learned into the main project.

In particular, here I would set aside all the scripting. I would make a demo that does nothing but present a sequence of stimulus images (using a Loop component) in a fixed order (I always save randomizaiton for the last step in development, it greatly simplifies the testing!). Then I would add a distractor image. Etc.

Anyway, I did some fussing around myself, and it looks like the following should work in your Content:
<img id="distractor-image" src=${this.files[this.parameters.distractor]} />

You have to pay attention to where each $, {}, and [] should go.

from lab.js.

mcfarla9 avatar mcfarla9 commented on July 4, 2024

Oh, since you used this.files in your Content, I assumed that you were storing the distractor files directly within the stimulus component. But from your screen shot it looks like you are storing your distractor files out in the static area. That changes everything. In that case you would reduce that line in your Content to simply
<img id="distractor-image" src=${this.parameters.distractor} />

Or if in your Loop you would rather put just the distractor file names without "static/" at the front of each one, you could add the "static/" string in the Content thus
<img id="distractor-image" src="static/${this.parameters.distractor}" />

from lab.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.