sleep: Prevents accidental map scrolling when scrolling in a...

suspendScrollR Documentation

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

leaflet(width = "100%") %>%
  setView(0, 0, 1) %>%
  addTiles() %>%
  suspendScroll()

bhaskarvk/leaflet.extras documentation built on April 23, 2024, 9:32 a.m.