fullPage
fullPage copied to clipboard
Fullpage scrolling with map
Hi, first of all, thanks for the amazing implementation of fullPage in R!
I'd like to have a slide with a fullpage map where scrolling does not zoom but scroll to the next slide. To avoid zooming, I set the leaflet options. But scrolling to the next slide does not work. Is there any workaround?
Thanks a lot!!
Here is some example code:
library(shiny)
library(fullPage)
library(tmap)
data("World")
ui <-
fullPage::pagePiling(
sections.color = c('#fff','#000', '#fff'),
menu = c("Full Page" = "Link1",
"Map" = "Map",
"Another Full Page" = "Link2"),
fullSection(menu = "Link1", center = TRUE, tags$h1("FULL PAGE 1")),
fullSection(menu = "Map", tmapOutput("fpmap", width = "100%", height = "100%")),
fullSection(menu = "Link2", center = TRUE, tags$h1("FULL PAGE 2"))
)
server <- function(input, output, session) {
output$fpmap <- renderTmap({
tm_shape(World) +
tm_view(set.view = c(11.57549, 56.13743, 4),
control.position = c("right","bottom"),
leaflet.options = list(minZoom=4, maxZoom=4,
zoomControl = FALSE, dragging = FALSE,
keyboard = FALSE)) +
tm_polygons("HPI")
})
}
shinyApp(ui = ui, server = server)
Yes this is a recurring issue because it's not clearly documented. You can keep scroll from switching page/slide with an option: specify the id
(probably fmap
in your case) of the element to said option.
An example for a drop down here
Let me know if this helped
Dear John, thanks for your fast response and your support.
I am not sure if your example meets my problem, as I understand that in this example scrolling is prevented for some elements while I would like to activate it for the map. I have a full page map (with disabled zooming) and I would like to scroll to the next page with my mouse wheel. I have edited my example code above to a full working example. I hope you will see, that sometimes scrolling in the map is working, but as soon as I "hit" a label in the map or click somewhere on the page, the mouse wheel is not scrolling anymore.
Thanks again :)
Apologies, I misunderstood your question. I'm not sure how to solve this as it seems to be on tmap's side, zoomControl = FALSE
disables the scroll completely.