r - 添加css“style = position:fixed;”时sidebarPanel缩小
问题描述
我需要有一个固定的侧边栏面板,但我在添加时遇到了问题style = 'position: fixed;'
。当我添加样式时,sidebarPanel 会缩小。下面的代码(带style = 'position: fixed;'
)。该图像显示了没有和使用style = 'position: fixed;'
如何使 sibarPanel 不收缩的结果?
# 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)
推荐阅读
- php - 使用 phantomJS 的 Codeception,使用真实浏览器的 fillField 可以,但是当我运行 codeception 时 KO
- ios - 在 Alamofire 中上传图像问题
- c# - 从字符串中剥离字符
- jquery - 在 jQuery datetimepicker 中阻止日期
- ibm-cloud - 无法在 IBM Cloud 中共享服务实例?
- javascript - Adobe Acrobat DC 中的条件格式颜色填充
- python - python中不同级别的反连接pandas数据帧
- html - 避免在 html 卡片中显示大数字
- meteor - Meteor Blaze 模板 - 动态字段名称
- sql - PIVOTING IN SQL - 将 col 转换为行