2016-02-26 24 views
1

我想將absolutePanel的背景設置爲透明,但面板中的所有控件都是正常的。背景中有光澤的絕對面板

css樣式通過標籤$ style添加,但所有子控件都變爲透明。我應該如何實現這一目標?

PS:下面我的CSS代碼將不會工作

library(shiny) 
ui <- shinyUI(

    fluidPage(
     tags$head(tags$style(
     HTML(' 
      #input_date_control {opacity : 0;} 
      #sel_date {opacity: 1;}') 
    )), 
     absolutePanel(
     sliderInput('sel_date', NULL, 0, 5, 5, width = '80%') 
     , id = "input_date_control", class = "panel panel-default", fixed = TRUE 
     , draggable = FALSE, top = 'auto', left = '20', right = 'auto', bottom = 20 
     , width = '60%', height = 'auto' 
    ))) 

server <- function(input, output, session) { 

} 

shinyApp(ui, server) 

回答

1

提出以下建議在此頁:I do not want to inherit the child opacity from the parent in CSS,我解決我的問題

library(shiny) 
ui <- shinyUI(

    fluidPage(
     tags$head(tags$style(
     HTML(' 
      #input_date_control {background-color: rgba(0,0,255,0.2);;} 
      #sel_date {background-color: rgba(0,0,255,1);}') 
    )), 
     absolutePanel(
     sliderInput('sel_date', NULL, 0, 5, 5, width = '80%') 
     , id = "input_date_control", class = "panel panel-default", fixed = TRUE 
     , draggable = FALSE, top = 'auto', left = 30, right = 'auto', bottom = 10 
     , width = '60%', height = 'auto' 
    ))) 

server <- function(input, output, session) { 

} 

shinyApp(ui, server)