вращающаяся страница в flexdashboard - PullRequest
0 голосов
/ 01 февраля 2019

Я создаю flexdashboard, в который я добавил две страницы, имеющие разную ориентацию и расположение.Я хочу отображать страницу одну за другой через каждые 1 минуту.(Page1-Page2-Page1 ...).

Для этого я следовал подходу, чтобы скрыть / показать страницу 2. Мой вопрос - как мне установить реактивный таймер, чтобы он мог скрывать и отображать Page2через каждые 1 мин.

Вот что я сделал до сих пор.

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

1 Ответ

0 голосов
/ 01 февраля 2019

Просто используйте 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}
```

enter image description here

...