我正在尝试构建一个显示leaflet地图的应用程序。使用该应用程序的人大多数是通过移动设备进行操作,因此将地图完全展示在屏幕上会更加方便。您可以在此处查看该应用程序:https://js1984.shinyapps.io/stackoverflow/
使用
到目前为止,我发现的所有解决方案都没有对我起作用,例如在CSS中设置高度为100%:
应用程序的UI部分如下所示:
leafletOutput("mymap", width = "100%")
可以正常设置宽度,但是我无法将高度设置为 leafletOutput("mymap", width = "100%", height = "100%")
:当我运行应用程序时,地图会消失... 将高度设置为固定值可以正常工作,但是显然这不是一个选项。到目前为止,我发现的所有解决方案都没有对我起作用,例如在CSS中设置高度为100%:
html, body, #mymap {
height:100%;
width:100%;
padding:0px;
margin:0px;
}
应用程序的UI部分如下所示:
ui <- navbarPage(title = "test",
collapsible = T,
position= "static-top",
inverse = T,
#####################################
# the tab panel that includes the MAP
#####################################
tabPanel("Map",
includeCSS(path="www/bootstrap.css"),
leafletOutput("mymap", width = "100%")
),
#####################################
# other tab panels
#####################################
tabPanel("Fri",
fluidRow(
includeCSS(path="www/bootstrap.css"),
column(6,
offset = 3,
wellPanel(
checkboxGroupInput("freitag",
h3("Freitag"),
list_fr,
selected = 1
)
)
)
)
),
tabPanel("Sat",
fluidRow(
column(6,
offset = 3,
wellPanel(
checkboxGroupInput("samstag",
h3("Samstag"),
list_sa
)
)
)
)
),
tabPanel("Sun",
fluidRow(
column(6,
offset = 3,
wellPanel(
checkboxGroupInput("sonntag",
h3("Sonntag"),
list_so
)
)
)
)
),
tabPanel("Mon",
fluidRow(
column(6,
offset = 3,
wellPanel(
checkboxGroupInput("montag",
h3("Montag"),
list_mo
)
)
)
)
),
tabPanel("Tues",
fluidRow(
column(6,
offset = 3,
wellPanel(
checkboxGroupInput("dienstag",
h3("Dienstag"),
list_di
)
)
)
)
)
)