mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 11:10:54 +00:00
Add real-time value display feature to plugin-image-slider-response
Added real-time value display feature to plugin-image-slider-response: if the parameter value_display is set as true, the slider's value will be displayed in real-time below the slider as participants adjust it. Before participants adjust the slider, the displayed value will be the slider_start value
This commit is contained in:
parent
87cf4bff1d
commit
fcd8dd771c
@ -108,6 +108,11 @@ const info = <const>{
|
|||||||
type: ParameterType.BOOL,
|
type: ParameterType.BOOL,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
/** If true, the slider's value will be displayed in real time below the slider. */
|
||||||
|
value_display: {
|
||||||
|
type: ParameterType.BOOL,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
/** The path of the image that was displayed. */
|
/** The path of the image that was displayed. */
|
||||||
@ -222,7 +227,13 @@ class ImageSliderResponsePlugin implements JsPsychPlugin<Info> {
|
|||||||
trial.max +
|
trial.max +
|
||||||
'" step="' +
|
'" step="' +
|
||||||
trial.step +
|
trial.step +
|
||||||
'" id="jspsych-image-slider-response-response"></input>';
|
'" id="jspsych-image-slider-response-response" ';
|
||||||
|
if (trial.value_display) {
|
||||||
|
html += 'oninput="this.nextElementSibling.value = this.value"></input>';
|
||||||
|
html += "<output>" + trial.slider_start + "</output>";
|
||||||
|
} else {
|
||||||
|
html += "></input>";
|
||||||
|
}
|
||||||
html += "<div>";
|
html += "<div>";
|
||||||
for (var j = 0; j < trial.labels.length; j++) {
|
for (var j = 0; j < trial.labels.length; j++) {
|
||||||
var label_width_perc = 100 / (trial.labels.length - 1);
|
var label_width_perc = 100 / (trial.labels.length - 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user