与r闪亮仪表板侧边栏面板的绝对面板碰撞

时间:2018-05-09 10:48:33

标签: r shiny shinydashboard

我正在尝试将absolutePanel添加到我闪亮的信息中心应用中。我希望面板位于页面底部,窗口宽度,并在侧边栏可见时调整到它。问题是当侧边栏打开时,一些面板不可见:

left part of the panel not visible

另一方面,如果我从面板的左侧设置宽度并关闭侧边栏,那么它远离窗口的左端:

panel too short

这是一个可重现的代码:

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

1 个答案:

答案 0 :(得分:3)

尝试删除absolutePaneldiv生成的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) 样式:

% Define needed variables.
username = getPrefOrPrompt('Username');
password = getPrefOrPrompt('Password');
developerKey = 'AI39si7J7QPwNZriOcSa6z2wpbYbN2pFgI9Xdvv4EYSq84SssGa9pB_UwNmaXYiCVXA';
clientid = 'ytapi-MatthewSimoneau-YouTubeUploadfro-ge7j8nsn-0';

% Upload the file.
service = YouTubeService(clientid, developerKey);