在 flexdashboard 中旋转页面

rotating page in flexdashboard

我正在创建一个 flexdashboard,我在其中添加了两个具有不同方向和布局的页面。 我想每 1 分钟一页一页地显示页面。 (Page1-Page2-Page1...).

为此,我遵循了 hide/unhide 第 2 页的方法。我的问题是如何放置反应式计时器,以便它可以在每 1 分钟后隐藏和取消隐藏第 2 页。

这是我到目前为止所做的。

---
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}
```

只需使用 Javascript 即可实现:

---
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}
```