0

I am creating a flexdashboard in which I added two pages having different orientation and layout. I want to display the page one by one after every 1 min. (Page1-Page2-Page1...).

For doing this, I followed the approach to hide/unhide Page 2. My question is how can I put the reactive timer so that it can hide and unhide Page2 after every 1 min.

Here is what I have done so far.

---
title: "rotating screen check"
output: 
  flexdashboard::flex_dashboard:
  orientation: column
  vertical_layout: fill
  # runtime: shiny
---



Page 1
=====================================

Link to [Page 3] (#page-3)

### Chart 1 of page 1


Page 3 {.hidden}
=====================================

### Chart 1 of Page 3

```{r}
```
Martin Schmelzer
  • 23,283
  • 6
  • 73
  • 98

1 Answers1

0

Just use Javascript to achieve that:

---
title: "rotating screen check"
output: 
  flexdashboard::flex_dashboard:
  orientation: column
  vertical_layout: fill
  # runtime: shiny
---

<script>
$(document).ready(function() {  # when the document finished loading...
  setInterval(function(){  # create an interval function...
    $("#page-1").toggle("hide");  # that selects the first page and toggles its visibility
    $("#page-3").toggle("hide");  # and does the same with the second page.
  }, 2000);  # in milliseconds, 1 minute = 60000 milliseconds

})
</script>


Page 1
=====================================

Link to [Page 3] (#page-3)

### Chart 1 of page 1


Page 3 {.hidden}
=====================================

### Chart 1 of Page 3

```{r}
```

enter image description here

Martin Schmelzer
  • 23,283
  • 6
  • 73
  • 98