Prevent unwanted scroll capturing; let you map sleep
HTML JavaScript
Latest commit be18ded Jan 21, 2017 @atstp atstp committed on GitHub Merge pull request #22 from kamilnowak/fix-remove-hook
Fix dragging on touch devices after disabling Sleep handler


Leaflet's stock maps are event-greedy and interfere with scrolling.

Leaflet.Sleep is an interaction manager, helping your map do what you want when you want.



Available on npm, bower, and straight from the single. source file

Leaflet.Sleep is enabled by default, and can be disabled with the map's sleep option.


npm install leaflet-sleep


bower install leaflet-sleep


These are the new options available for and their defaults.

    // false if you want an unruly map
    sleep: true,

    // time(ms) until map sleeps on mouseout
    sleepTime: 750,

    // time(ms) until map wakes on mouseover
    wakeTime: 750,

    // should the user receive wake instructions?
    sleepNote: true,

    // should hovering wake the map? (non-touch devices only)
    hoverToWake: true,

    // a message to inform users about waking the map
    wakeMessage: 'Click or Hover to Wake',

    // a constructor for a control button
    sleepButton: L.Control.sleepMapControl,

    // opacity for the sleeping map
    sleepOpacity: .7

MIT Licensed