我正在创建一个flexdashboard,我在其中添加了两个具有不同方向和布局的页面。我想每隔1分钟一个接一个地显示页面。(Page1-Page2-Page1...)。
为此,我遵循了隐藏/取消隐藏第2页的方法。我的问题是,如何设置反应式计时器,以便每隔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}发布于 2019-02-01 19:39:41
只需使用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}

https://stackoverflow.com/questions/54474959
复制相似问题