如何使用shinydashboard检查闪亮应用程序中浏览器的浏览器宽度并相应地更改框宽度

时间:2016-03-25 16:32:16

标签: javascript r shiny shinydashboard

我想检测浏览器宽度。如果css太小,则触发宽度在css中的变化。

基本上,如果移动屏幕宽度为50%,屏幕宽度为20%,如果屏幕宽度大于移动屏幕,则我想更改屏幕宽度

以下是我的代码

box(
      title = "KPI Table"
      ,div(style="display:block;width: 20%;float: left;margin: 0 10px;"
          ,selectInput('slice', 'Time View'
                   , c('Day', 'Week', 'Month', 'Quarter', 'Year')
                   , selected = 'Month'))
      , DT::dataTableOutput('KPITab')
      , status = "primary"
      , width = 12
      , collapsible = TRUE)
    )

我想使用javascript来检测宽度的变化,并在div中将值更改为20%到50%。

由于

1 个答案:

答案 0 :(得分:-1)

Css样式有“width-minimum”选项是简单的替代解决方案。