gadenbuie / countdown

⏲ countdown timer for R Markdown slides and HTML docs
https://pkg.garrickadenbuie.com/countdown
150 stars 15 forks source link

Continue countdown across slides #14

Closed jvcasillas closed 4 years ago

jvcasillas commented 5 years ago

This is a fantastic package. If I use a countdown in xaringan is there a way to make the countdown continue from the same point as I move through slides? For example, I am practicing for a 20 minute talk and I would like the timer to continue counting down from 20 throughout the presentation. Any way to do this?

edit: I realized I was not using this package the way I thought I was, but I believe my question is still relevant so I made some edits.

gadenbuie commented 4 years ago

Hi @jvcasillas thanks for the feature request! Unfortunately, there isn't an easy way to do this in a xaringan Rmarkdown document.

If you're feeling adventurous, it is theoretically possible to put the timer in a separate HTML file. If you create a file timer.html from this timer.Rmd

---
output: html_document_base
---

```{r, echo=FALSE}
countdown::countdown(20, style = "z-index:100")

and then delete _everything_ in the HTML file except for the `<style>`, `<script>`, and `<div>` tags related to `countdown` (also delete the `<html>`, `<head>` and `<body>` tags, too), ... you can include this in the slides doc in the `after_body`:

output: xaringan::moon_reader: includes: after_body: timer.html



and you'll end up with a timer that sticks to the bottom right corner throughout your slides.

Note that if you use timers inside your presentation, then you only need to keep the `<div class="countdown">` html and it should be picked up by the scripts/styles defined in your slides.
jvcasillas commented 4 years ago

Really cool idea. I’ll give it a try. Thanks! Update: Worked like a charm!