3

I am creating 100 + leaflet maps in my shiny app. The maps are 100% of the width of the page, so when the user goes to scroll down the page it zooms the map but I would like it to continue scrolling down the page.

I've found this similar answer but I want the scrollWheelZoom to disabled all the time for every map.

Is there a way to change the Javascript to disable the scrollWheelZoom for all maps?

Shiny: Is there a way to enable mouse wheel zoom only after click on map in shiny?

1 Answer 1

1

Depending on how you're creating the maps, something like this should work:

output$map <- renderLeaflet({
    leaflet(options = leafletOptions(minZoom = 0,
                                     scrollWheelZoom = FALSE))  %>%
      addTiles()
})

The scroolWheelZoom property which is now built in to R shiny does the trick.

Not the answer you're looking for? Browse other questions tagged or ask your own question.