【发布时间】:2021-11-12 03:23:02
【问题描述】:
我想知道为我的 3 个闪亮的主标签面板中的每一个设置不同图像的最简单方法是什么?
我认为在它们每个中使用setBackgroundImage(src = "image1.jpg", shinydashboard = TRUE)、setBackgroundImage(src = "image2.jpg", shinydashboard = TRUE) 等都可以解决问题,但不幸的是它并不那么简单。
我想我应该使用一些 CSS,但我对此很陌生,我还没有找到解决问题的方法。
你猜我应该怎么做?
最小的应用程序:
library(shiny)
library(shinyWidgets)
ui <- shinyUI(navbarPage(id="Test", "TEST",
header = tagList(
useShinydashboard()
),
tabPanel(
"Welcome", value="welcome",
verbatimTextOutput("text1")),
tabPanel(
"Tab1", value="first_tab",
verbatimTextOutput("text2")),
tabPanel(
"Tab2", value="second_tab",
verbatimTextOutput("text3"))))
server <- shinyServer(function(input, output, session){
output$text1 <- renderText("Trying to set up a first background image in this whole panel")
output$text2 <- renderText("Trying to set up a second background image in this whole panel")
output$text3 <- renderText("Trying to set up a third background image in this whole panel")
})
shinyApp(ui, server)
【问题讨论】:
-
请分享一些代码,包括使用的库。
-
我已经编辑了我的代码!
标签: css r shiny setbackground