diff --git a/docs/demos/jspsych-audio-button-response-demo-2.html b/docs/demos/jspsych-audio-button-response-demo-2.html index 3801cd27..3875f7ad 100644 --- a/docs/demos/jspsych-audio-button-response-demo-2.html +++ b/docs/demos/jspsych-audio-button-response-demo-2.html @@ -3,7 +3,8 @@ - + + @@ -30,7 +31,7 @@ stimulus: 'sound/roar.mp3', choices: images, prompt: "

Which animal made the sound?

", - button_html: '' + button_html: (choice)=>`` }; timeline.push(trial); diff --git a/docs/demos/jspsych-audio-button-response-demo-3.html b/docs/demos/jspsych-audio-button-response-demo-3.html new file mode 100644 index 00000000..e4f95ac8 --- /dev/null +++ b/docs/demos/jspsych-audio-button-response-demo-3.html @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + diff --git a/docs/demos/sound/telephone.mp3 b/docs/demos/sound/telephone.mp3 new file mode 100644 index 00000000..5fc6954c Binary files /dev/null and b/docs/demos/sound/telephone.mp3 differ diff --git a/docs/plugins/audio-button-response.md b/docs/plugins/audio-button-response.md index f20155f4..90a9defe 100644 --- a/docs/plugins/audio-button-response.md +++ b/docs/plugins/audio-button-response.md @@ -89,13 +89,13 @@ import audioButtonResponse from '@jspsych/plugin-audio-button-response'; ???+ example "Using custom button HTML to use images as buttons" === "Code" ```javascript - var trial = { - type: jsPsychAudioButtonResponse, - stimulus: 'sound/roar.mp3', - choices: ['lion.png', 'elephant.png', 'monkey.png'], - prompt: "

Which animal made the sound?

", - button_html: '' - }; + const trial = { + type: jsPsychAudioButtonResponse, + stimulus: 'sound/roar.mp3', + choices: images, + prompt: "

Which animal made the sound?

", + button_html: (choice)=>`` + }; ``` === "Demo" @@ -105,7 +105,23 @@ import audioButtonResponse from '@jspsych/plugin-audio-button-response'; Open demo in new tab - **Note**: if you want the images to look more like jsPsych buttons, i.e. with borders and different styles for hover/active/disabled states, then you can also embed the image element inside the default `button_html` string: - ```js - button_html: '' - ``` \ No newline at end of file +???+ example "Setting up a grid-based layout" + === "Code" + ```javascript + const trial = { + type: jsPsychAudioButtonResponse, + stimulus: 'sound/telephone.mp3', + prompt: '

Which key was pressed first?

', + choices: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '*', '0', '#'], + button_layout: 'grid', + grid_rows: 4, + grid_columns: 3 + } + ``` + + === "Demo" +
+ +
+ + Open demo in new tab \ No newline at end of file