mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-12 16:48:12 +00:00
42 lines
1.1 KiB
HTML
42 lines
1.1 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<script src="js/jquery.min.js"></script>
|
|
<script src="../jspsych.js"></script>
|
|
<script src="../plugins/jspsych-categorize.js"></script>
|
|
<link rel="stylesheet" href="../css/jspsych.css"></link>
|
|
<style>
|
|
img { width: 300px; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="jspsych-target"></div>
|
|
</body>
|
|
<script>
|
|
|
|
var trials = {
|
|
type: 'categorize',
|
|
stimuli: ['img/happy_face_1.jpg','img/sad_face_3.jpg'],
|
|
key_answer: [72,83],
|
|
choices: [72,83],
|
|
text_answer: ['happy','sad'],
|
|
correct_text: "<p class='center-content'>Correct. This face is %ANS%.</p>",
|
|
incorrect_text: "<p class='center-content'>Incorrect. This face is %ANS%.</p>",
|
|
prompt: "<p class='center-content'>Press H if the face is happy. Press S if the face is sad.</p>",
|
|
timing_response: 1500,
|
|
show_feedback_on_timeout: false,
|
|
force_correct_button_press: true
|
|
};
|
|
|
|
function start(){
|
|
jsPsych.init({
|
|
display_element: $('#jspsych-target'),
|
|
experiment_structure: [trials]
|
|
});
|
|
}
|
|
|
|
jsPsych.preloadImages(['img/happy_face_1.jpg','img/sad_face_2.jpg'], start);
|
|
|
|
</script>
|
|
</html>
|