Arranging buttons in na 2x2 grid

376 views
Skip to first unread message

Dritan Nikolla

unread,
Dec 13, 2017, 12:30:54 PM12/13/17
to jsPsych
Hi Josh,

I am using the new plugin "audio-button-response", the button section, to display 4 images on which the participants will click. Is there a way I can arrange their position so that I can ensure they will always display in a 2x2 grid using CSS? I can only get class name for them In cannot get id information for each of the buttons because they are generated on run time? I am not sure I even got the question right here.

Please let me know.

Best,
Dritan

Josh de Leeuw

unread,
Dec 17, 2017, 2:07:51 PM12/17/17
to Dritan Nikolla, jsPsych
It's probably possible with some clever CSS and using the button_html property of the plugin to manually specify the HTML for the buttons. But I'm not sure off the top of my head how to do it; it would take some playing around with the markup to see. --Josh

--
You received this message because you are subscribed to the Google Groups "jsPsych" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jspsych+u...@googlegroups.com.
To post to this group, send email to jsp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jspsych/e8760bd5-7708-4bdf-8ce8-a6e150811380%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dritan Nikolla

unread,
Dec 17, 2017, 5:52:56 PM12/17/17
to Dritan Nikolla, jsPsych
Hi Josh,

Thank you for your response. I have found a solution but it involved modifying the core jspsych.js file to get it to target a particular <div> as opposed to body. After that, the targeted <div> was amenable to the normal CSS routines which made what I wanted to do possible. If someone is interested or needs something similar, just drop a line in this thread and I will put the details in.

Thanks again,
Dritan

--
You received this message because you are subscribed to a topic in the Google Groups "jsPsych" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jspsych/wJL4RD0i5XQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jspsych+u...@googlegroups.com.

Josh de Leeuw

unread,
Dec 17, 2017, 9:21:15 PM12/17/17
to Dritan Nikolla, jsPsych
Just a note that you can target another div instead of the body tag with the display_element option in jsPsych.init(), so you probably don't need to modify the base jspsych.js code to do this.

On Sun, Dec 17, 2017 at 5:52 PM 'Dritan Nikolla' via jsPsych <jsp...@googlegroups.com> wrote:
Hi Josh,

Thank you for your response. I have found a solution but it involved modifying the core jspsych.js file to get it to target a particular <div> as opposed to body. After that, the targeted <div> was amenable to the normal CSS routines which made what I wanted to do possible. If someone is interested or needs something similar, just drop a line in this thread and I will put the details in.

Thanks again,
Dritan

On 13 Dec 2017, at 17:30, 'Dritan Nikolla' via jsPsych <jsp...@googlegroups.com> wrote:

Hi Josh,

I am using the new plugin "audio-button-response", the button section, to display 4 images on which the participants will click. Is there a way I can arrange their position so that I can ensure they will always display in a 2x2 grid using CSS? I can only get class name for them In cannot get id information for each of the buttons because they are generated on run time? I am not sure I even got the question right here.

Please let me know.

Best,
Dritan

--
You received this message because you are subscribed to a topic in the Google Groups "jsPsych" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jspsych/wJL4RD0i5XQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jspsych+u...@googlegroups.com.

To post to this group, send email to jsp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jspsych/e8760bd5-7708-4bdf-8ce8-a6e150811380%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "jsPsych" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jspsych+u...@googlegroups.com.

To post to this group, send email to jsp...@googlegroups.com.

Dritan Nikolla

unread,
Dec 17, 2017, 9:23:46 PM12/17/17
to Josh de Leeuw, jsPsych
Hi Josh,

I did try that, it didn’t work. It may be a bug, but more likely I messed something up. I will see if maybe I missed something and let you know.

Cheers for bringing this up,
Dritan

Dritan Nikolla

unread,
Dec 22, 2017, 5:31:26 AM12/22/17
to Josh de Leeuw, jsPsych
Hi Josh,

I tried again your suggestion and it worked. Using display_element works fine. I am not sure what happened before.

All the best,
Dritan.
Reply all
Reply to author
Forward
0 new messages