R 当添加css“style=position:fixed;”时,侧边栏面板收缩
我需要一个固定的侧边栏面板,但是当addstyle='position:fixed;'时,我遇到了问题。添加样式时,侧边栏面板会收缩。 样式为'position:fixed;'的代码在下面此图显示了不带和带有样式='position:fixed;'我怎样才能使sibarPanel不收缩R 当添加css“style=position:fixed;”时,侧边栏面板收缩,r,shiny,R,Shiny,我需要一个固定的侧边栏面板,但是当addstyle='position:fixed;'时,我遇到了问题。添加样式时,侧边栏面板会收缩。 样式为'position:fixed;'的代码在下面此图显示了不带和带有样式='position:fixed;'我怎样才能使sibarPanel不收缩 # User interface ui <- fluidPage( sidebarLayout( sidebarPanel(width = 2, style=
# User interface
ui <- fluidPage(
sidebarLayout(
sidebarPanel(width = 2,
style='position: fixed;',
uiOutput("countryList")),
mainPanel(
plotOutput("distPlot1"),
plotOutput("distPlot2"),
plotOutput("distPlot3"))))
# Server logic
server <- function(input, output) {
output$countryList <- renderUI({
selectizeInput("countryName", "Country",
choices = c('Austria', 'The United Kingdom'))})
output$distPlot1 <- renderPlot({hist(rnorm(100))})
output$distPlot2 <- renderPlot({hist(rnorm(200))})
output$distPlot3 <- renderPlot({hist(rnorm(300))})}
shinyApp(ui, server)
我认为这是一种方式:
library(shiny)
# User interface
ui <- fluidPage(
div(class = "row",
div(class = "col-sm-4",
tags$form(class = "well col-sm-4", `data-spy` = "affix", # this is the sidebar
uiOutput("countryList")
)
),
div(class = "col-sm-8", # this is the main panel
plotOutput("distPlot1"),
plotOutput("distPlot2"),
plotOutput("distPlot3")
)
)
)
# Server logic
server <- function(input, output) {
output$countryList <- renderUI({
selectizeInput("countryName", "Country",
choices = c('Austria', 'The United Kingdom'))})
output$distPlot1 <- renderPlot({hist(rnorm(100))})
output$distPlot2 <- renderPlot({hist(rnorm(200))})
output$distPlot3 <- renderPlot({hist(rnorm(300))})}
shinyApp(ui, server)