leaflet.extras (version 1.0.0)

suspendScroll: Prevents accidental map scrolling when scrolling in a document.

Description

Prevents accidental map scrolling when scrolling in a document.

Usage

suspendScroll(map, sleep = TRUE, sleepTime = 750, wakeTime = 750,
  sleepNote = TRUE, hoverToWake = TRUE,
  wakeMessage = "Click or Hover to Wake", sleepOpacity = 0.7)

Arguments

map

The leaflet map

sleep

false if you want an unruly map

sleepTime

time(ms) until map sleeps on mouseout

wakeTime

time(ms) until map wakes on mouseover

sleepNote

should the user receive wake instructions?

hoverToWake

should hovering wake the map? (non-touch devices only)

wakeMessage

a message to inform users about waking the map

sleepOpacity

opacity for the sleeping map

Examples

Run this code
# NOT RUN {
leaflet(width = "100%") %>%
  setView(0, 0, 1) %>%
  addTiles() %>%
  suspendScroll()
# }

Run the code above in your browser using DataLab