Socket
Socket
Sign inDemoInstall

leaflet-sleep

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    leaflet-sleep

Plugin for Leaflet for preventing unwanted scroll capturing


Version published
Maintainers
1
Created

Readme

Source

Leaflet.Sleep

When scrolling a page and your cursor crosses a leaflet map, the scroll is stopped and the map zooms — not friendly.

L.Sleep removes the dilemma between

  • disabling scrollZoom for the pages sake
  • enabling scrollZoom for the map's sake

It's an interaction-manager for your map: with user-interest it wakes the map and when ignored the map won't interfere.

demo/example

Use

Either npm install leaflet-sleep or copy/paste the source

all you need to do is include the plugin and you'll be good to go

<script src="Leaflet.Sleep.js"></script>

Config

These are the new options available for L.map 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,

    // defines whether the user is prompted on how to wake map
    sleepNote: true,

    // should hovering wake the map?
    hoverToWake: true,

    // specify a custom message to notify users how to wake
    wakeMessage: ('Click ' + (hoverToWake?' or Hover ' : '') + 'to Wake'),

    // opacity (between 0 and 1) of inactive map
    sleepOpacity: .7
}

MIT Licensed

FAQs

Last updated on 09 Jun 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc