I'm having trouble making my leaflet map in Shiny go fullscreen. While I can obviously just manually set the width and height of the map to my screen-size, I'd like to the map to adapt to whatever screen-size it is shown on.
How do I go about automating the size of the map?
Here's the code I've been trying so far. Unfortunately, however, this doesn't adjust the height properly.
library(shiny)
library(leaflet)
location=c(46.52433,10.12633)
ui <- fluidPage(
tags$head(tags$style(HTML("#map {height:100%, width:100%;}"))),
leafletOutput("map")
)
server <- function(input, output, session) {
output$map = renderLeaflet({
leaflet() %>% addTiles() %>% setView(lat = location[1],lng = location[2],zoom = 10) %>%
addMarkers(lat = location[1],lng = location[2],popup = "Test") })
}
shinyApp(ui, server)
Any help would be greatly appreciated, thanks!