簡體   English   中英

帶有r閃亮的儀表板側欄面板的絕對面板碰撞

[英]Absolute panel collision with r shiny dashboard sidebar panel

我正在嘗試將absolutePanel添加到我的閃亮儀表板應用程序中。 我希望面板位於頁面底部,具有窗口的寬度,並在邊欄可見或不可見時對其進行調整。 問題是,在打開側欄時,某些面板不可見:

面板的左部分不可見

另一方面,如果我從面板的左側設置寬度並關閉側邊欄,則它離窗口的左端很遠:

面板太短

這是可復制的代碼:

## app.R ##
library(shiny)
library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(),
  dashboardBody(
    absolutePanel(
      bottom = 0, left = 0, right = 0, # or left = 300
      fixed = TRUE,
      wellPanel(
        style = "padding: 8px; border-bottom: 1px solid #CCC; background: #FFFFEE;",
        HTML("Save changes?"),
        actionButton("save", "Save"),
        actionButton("cancel", "Cancel")
      )
    )
  )
)

server <- function(input, output) { }

shinyApp(ui, server)

嘗試使用它產生的div刪除absolutePanel ,並為其添加足夠高的z-index以進行樣式設置:

library(shiny)
library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(),
  dashboardBody(
    div(
      style = "left:0px; right:0px; bottom:0px; position:fixed; cursor:inherit; z-index: 10000;",
      wellPanel(
        style = "padding: 8px; border-bottom: 1px solid #CCC; background: #FFFFEE;",
        HTML("Save changes?"),
        actionButton("save", "Save"),
        actionButton("cancel", "Cancel")
      ) 
    )
  )
)

server <- function(input, output) { }

shinyApp(ui, server)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM