我正在创建一个Flexdashboard,在其中添加了两个页面,它们具有不同的方向和布局。 我想每1分钟显示一页。 (第1页-第2页-第1页...)。
为此,我遵循了隐藏/取消隐藏Page2的方法。我的问题是如何放置反应式计时器,以便它每隔1分钟就可以隐藏和取消隐藏Page2。
这是我到目前为止所做的。
---
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}
```
答案 0 :(得分:0)
只需使用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}
```