繁体   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