简体   繁体   English

带有r闪亮的仪表板侧栏面板的绝对面板碰撞

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

I'm trying to add absolutePanel to my shiny dashboard app. 我正在尝试将absolutePanel添加到我的闪亮仪表板应用程序中。 I want the panel to be at the bottom of the page with the width of the window and adjust to it when the sidebar is visible or not. 我希望面板位于页面底部,具有窗口的宽度,并在边栏可见或不可见时对其进行调整。 The problem is that when the sidebar is opened some of the panel is not visible: 问题是,在打开侧栏时,某些面板不可见:

面板的左部分不可见

On the other hand if I set the width from the left side of a panel and close the sidebar it's far from the left end of the window: 另一方面,如果我从面板的左侧设置宽度并关闭侧边栏,则它离窗口的左端很远:

面板太短

Here is a reproducible code: 这是可复制的代码:

## 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)

Try removing absolutePanel with div that it produces with added high enough z-index to style: 尝试使用它产生的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