mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 11:10:54 +00:00
58 lines
1.9 KiB
HTML
58 lines
1.9 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<script src="../jspsych.js"></script>
|
|
<script src="../plugins/jspsych-image-keyboard-response.js"></script>
|
|
<script src="../plugins/jspsych-html-keyboard-response.js"></script>
|
|
<link rel="stylesheet" href="../css/jspsych.css">
|
|
<style>
|
|
/*
|
|
Note that these CSS classes will only be added to the jspsych-content div.
|
|
In order for the CSS rules to be applied to the elements inside this div (stimulus, prompt, etc.),
|
|
the CSS properties will need to be inherited. Not all CSS properties are inherited from
|
|
parent elements, so this will limit what CSS properties you can change using the css_class parameter.
|
|
To learn more about CSS inheritance, see:
|
|
https://developer.mozilla.org/en-US/docs/Web/CSS/inheritance
|
|
https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Cascade_and_inheritance#inheritance
|
|
https://stackoverflow.com/questions/5612302/which-css-properties-are-inherited
|
|
*/
|
|
.condition1 {
|
|
color: red;
|
|
font: small-caps bold 30px/30px Arial, sans-serif;
|
|
line-height: 150%;
|
|
}
|
|
.condition2 {
|
|
color: green;
|
|
font-size: 40px;
|
|
text-decoration: underline wavy blue;
|
|
line-height: 200%;
|
|
background-color: aqua;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body></body>
|
|
<script>
|
|
|
|
var trial_procedure = {
|
|
timeline: [{
|
|
type: 'html-keyboard-response',
|
|
stimulus: jsPsych.timelineVariable('stim'),
|
|
css_classes: jsPsych.timelineVariable('css_class')
|
|
}],
|
|
timeline_variables: [
|
|
{css_class: ['condition1'], stim: 'This is the style for Condition 1.<br>Press any key to continue.'},
|
|
{css_class: ['condition2'], stim: 'This is the style for Condition 2.'},
|
|
{css_class: ['condition1'], stim: 'Here's Condition 1 again.'},
|
|
{css_class: ['condition2'], stim: 'Here's Condition 2 again.'},
|
|
]
|
|
}
|
|
|
|
jsPsych.init({
|
|
timeline: [trial_procedure]
|
|
});
|
|
|
|
</script>
|
|
|
|
</html>
|