Dropout Detection (with INVISIBLE timer)

96 views
Skip to first unread message

Daniyal Chawla

unread,
Jan 2, 2022, 1:50:33 PM1/2/22
to oTree help & discussion
Hi,

I would like to implement 'dropout detection' that you've shown on this link: https://www.otreehub.com/projects/otree-snippets/

However, is there a way to make the timer on top invisible to the user? i.e. the screen would still automatically skip after a certain amount of time, but the user wouldn't be able to see the timer.

Thanks!

BonnEconLab

unread,
Jan 2, 2022, 2:08:10 PM1/2/22
to oTree help & discussion
Hi Daniyal,

As you can check when running https://otree-snippets.herokuapp.com/demo/dropout_detection, the <div> around the timer is of the CSS class otree-timer.

Thus, including the following CSS instruction in your HTML template should achieve what you desire:

<style>
  .otree-timer {
    display: none;
  }
</style>

Here is a complete HTML example file:

<html>

<body>

<style>
  .alert {
    font-weight: bold;
    color: red;
  }
  .otree-timer {
    display: none;
  }
</style>

This should be visible.

<div class="otree-timer alert">
  This should be invisible.
</div>

This should be visible.

</body>

</html>


Best,

Holger

Daniyal Chawla

unread,
Jan 5, 2022, 6:42:56 PM1/5/22
to oTree help & discussion
Hi Holger,

Thank you so much for this! It worked perfectly.

Best,
Daniyal

Daniyal Chawla

unread,
Jan 17, 2022, 9:31:19 PM1/17/22
to oTree help & discussion
Hi Holger,

I had a quick follow-up question: is there a way to display the timer only for the last 10 seconds?

For example, let's say a screen is supposed to last 60 seconds. I want the timer at top to stay hidden for the first 50 seconds, and only show up at the last 10 seconds to let the user know that the screen is about to end.

Thank you!
Daniyal

On Sunday, January 2, 2022 at 2:08:10 PM UTC-5 BonnEconLab wrote:

Chris @ oTree

unread,
Jan 17, 2022, 9:43:48 PM1/17/22
to oTree help & discussion

Daniyal Chawla

unread,
Jan 17, 2022, 10:15:47 PM1/17/22
to oTree help & discussion
Thank you so much! It worked.
Reply all
Reply to author
Forward
0 new messages