how to check browser width of browser in shiny app with shinydashboard and change box width accordingly

Viewed 451

I wanted to detect browser width. And trigger width change in css if it is too small.

Basically, I want to change box width is 50% screen width if mobile and 20$ screen width if it larger than mobile screen

Following is my code

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

I want to use javascript to detect change in width and change value 20% to 50% in div .

Thanks

1 Answers
Related