Rmarkdown flexdashboard 值框无法在 Chrome 或 IE 中正确呈现(但可在 FireFox 中使用)
Rmarkdown flexdashboard valueboxes do not render properly in Chrome or IE (but work in FireFox)
我的 flexdashboard 在 firefox 中运行完美,但在 chrome 或 IE 中,值框无法正确呈现,它们隐藏在其他页面元素后面。我已经在其他几个网站上发布了这个,但一直没能得到答案(抱歉多了这句话,我收到一条错误消息,说我没有提供足够的细节,我不知道还能做什么添加).
这是我的代码的代表(还有一个 pastebin,以防它不能正常工作 https://pastebin.pl/view/1d1503f4):
---
title: "reprex"
runtime: shiny
output:
flexdashboard::flex_dashboard:
theme: yeti
orientation: rows
vertical_layout: scroll
social: menu
source: embed
---
<script>
$('.navbar-logo').wrap('<a href="http://www.website.com" target=blank>');
</script>
```{r setup, include=FALSE}
library(flexdashboard)
library(knitr) # for RMarkdown to HTML
library(rmarkdown) # to generate Rmd final document
library(shiny) # dashboard interactivity
```
Sidebar {.sidebar}
======================================================================
some text for the sidebar
some more text
Section 1
======================================================================
## Row 1 {data-height=9}
-------------------------------
### valuebox1
```{r}
valueBox("986070", icon = "fa-user-times")
```
### valuebox2
```{r}
valueBox("8619681", icon = "fa-user-times")
```
## Row {data-height=800 .tabset .tabset-fade}
----------------------------------------------------------------------
### some other stuff
```{r}
# generate leaflet object, define basemap
leaflet(height = 400) %>% addProviderTiles("CartoDB.Positron", group = "CartoDB (Default)") %>%
addProviderTiles("Esri.WorldStreetMap", group = "Esri") %>%
addProviderTiles("CartoDB.DarkMatter", group = "CartoDB Dark") %>%
addLayersControl(
baseGroups = c("CartoDB (Default)", "Esri", "CartoDB Dark"),
options = layersControlOptions(collapsed = FALSE))
absolutePanel(
draggable = FALSE, top = "2%", left = "5%", right = "auto", bottom = "auto",
width = '30%', height = 'auto',
style = "background: white; border:3px solid #eaf2f8; color: #5d6063; justify-content: center;",
p(strong("some text"))
)
```
random text
在 Firefox(顶部)和 Chrome/IE(底部)中显示:
picture of dashboard in both browers
我能够通过从包含值框的行中删除 data-height=50
来自己解决这个问题。对于将来遇到此错误的任何人。 Chrome 显然对 CSS/HTML 的解释与 Firefox 不同。如果有人可以提供关于为什么会发生的意见,我很想知道。
我的 flexdashboard 在 firefox 中运行完美,但在 chrome 或 IE 中,值框无法正确呈现,它们隐藏在其他页面元素后面。我已经在其他几个网站上发布了这个,但一直没能得到答案(抱歉多了这句话,我收到一条错误消息,说我没有提供足够的细节,我不知道还能做什么添加).
这是我的代码的代表(还有一个 pastebin,以防它不能正常工作 https://pastebin.pl/view/1d1503f4):
---
title: "reprex"
runtime: shiny
output:
flexdashboard::flex_dashboard:
theme: yeti
orientation: rows
vertical_layout: scroll
social: menu
source: embed
---
<script>
$('.navbar-logo').wrap('<a href="http://www.website.com" target=blank>');
</script>
```{r setup, include=FALSE}
library(flexdashboard)
library(knitr) # for RMarkdown to HTML
library(rmarkdown) # to generate Rmd final document
library(shiny) # dashboard interactivity
```
Sidebar {.sidebar}
======================================================================
some text for the sidebar
some more text
Section 1
======================================================================
## Row 1 {data-height=9}
-------------------------------
### valuebox1
```{r}
valueBox("986070", icon = "fa-user-times")
```
### valuebox2
```{r}
valueBox("8619681", icon = "fa-user-times")
```
## Row {data-height=800 .tabset .tabset-fade}
----------------------------------------------------------------------
### some other stuff
```{r}
# generate leaflet object, define basemap
leaflet(height = 400) %>% addProviderTiles("CartoDB.Positron", group = "CartoDB (Default)") %>%
addProviderTiles("Esri.WorldStreetMap", group = "Esri") %>%
addProviderTiles("CartoDB.DarkMatter", group = "CartoDB Dark") %>%
addLayersControl(
baseGroups = c("CartoDB (Default)", "Esri", "CartoDB Dark"),
options = layersControlOptions(collapsed = FALSE))
absolutePanel(
draggable = FALSE, top = "2%", left = "5%", right = "auto", bottom = "auto",
width = '30%', height = 'auto',
style = "background: white; border:3px solid #eaf2f8; color: #5d6063; justify-content: center;",
p(strong("some text"))
)
```
random text
在 Firefox(顶部)和 Chrome/IE(底部)中显示:
picture of dashboard in both browers
我能够通过从包含值框的行中删除 data-height=50
来自己解决这个问题。对于将来遇到此错误的任何人。 Chrome 显然对 CSS/HTML 的解释与 Firefox 不同。如果有人可以提供关于为什么会发生的意见,我很想知道。