real effort task - progress bar

101 views
Skip to first unread message

eka...@umich.edu

unread,
Aug 12, 2021, 4:56:39 PM8/12/21
to oTree help & discussion
More of a Javascript question:

I am using a rudimentary real effort task where subjects have to wait on a page for a given number of seconds.  I am using the progressbar.js implementation, with the progress tracker filling slowly from left to right.   However, I would like prevent participants from going to another page while waiting.  Is there a way to make the progress bar fill  only while subjects hold down a button?  

window.onload = setTimeout(
function onLoad() {
var bar = new ProgressBar.Line('#progress', {
strokeWidth: 4,
easing: 'linear',
duration: duration,
color: '#4169E1',
trailColor: '#eee',
trailWidth: 1,
svgStyle: {width: '100%', height: '100%'}
});

bar.animate(1.0); // Number from 0.0 to 1.0
},0);

Chris @ oTree

unread,
Aug 12, 2021, 7:53:07 PM8/12/21
to eka...@umich.edu, oTree help & discussion
Maybe someone can give more specific advice about this task, but regarding real effort tasks have you seen this new set of games? https://otree-realeffort.herokuapp.com/demo

Sent from my phone

On Aug 12, 2021, at 2:56 PM, eka...@umich.edu <eka...@umich.edu> wrote:

More of a Javascript question:
--
You received this message because you are subscribed to the Google Groups "oTree help & discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to otree+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/otree/6159816d-b775-4cef-a576-a2e21fe60aa4n%40googlegroups.com.

rkzl...@gmail.com

unread,
Aug 13, 2021, 3:10:14 AM8/13/21
to Chris @ oTree, eka...@umich.edu, oTree help & discussion

This one seems promising. You may also think to create a function of looping checks similar to this one where you break the loop once you see that the mouse is not downed.

 

https://stackoverflow.com/questions/15505272/javascript-while-mousedown

eka...@umich.edu

unread,
Aug 13, 2021, 10:52:58 AM8/13/21
to oTree help & discussion
Thank you, very helpful!
Reply all
Reply to author
Forward
0 new messages