0

我正在构建一个闪亮的应用程序,由侧边栏和主面板组成。因为我想让这个应用程序对移动设备友好,所以我想在屏幕变窄时默认折叠侧边栏。

我尝试过使用 shinyBS::bsCollapse()。有了这个,我可以制作一个可折叠的侧边栏,但我仍然需要单击才能折叠/取消折叠。

有没有一种方法可以通过根据用户与应用程序的宽度自动折叠/展开它来使其响应?还是其他解决方案?

一个最小的例子:

library(shiny)
library(shinyBS)

shinyApp(
    ui = fluidPage(
        column(width=3,
            bsCollapse(
                bsCollapsePanel("sidebar",
                             selectInput("filter", "A filter",c("default", "primary"))))),
        column(width = 9,
                mainPanel(
                    p("mainpanel")
                ))),
    server = function(input, output, session) {}
)
4

0 回答 0