Skip to content

tinuzz/leaflet-messagebox

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 

A Leaflet plugin to display a temporary message on a map. (Demo)

Leaflet.Messagebox

Leaflet.Messagebox is a simple control to display a temporary message, like an error, on a Leaflet map. The message is hidden after a configurable timeout.

Using the Messagebox

There a are two ways to add the messagebox to the map. First:

var options = { timeout: 5000 }
var box = L.control.messagebox(options).addTo(map);

or, add it on map initialization:

var map = L.map( 'mapdiv', {'messagebox': true, ...} );
map.messagebox.options.timeout = 5000;

Then, show a message/alert:

box.show( 'This is the message' );

or, when implicitly used with the map:

map.messagebox.show( 'This is the message' );

Available Options:

There are only two options:

position: (string) The standard Leaflet.Control position parameter. Optional, defaults to 'topright'

timeout: (integer) The duration the messagebox/notification is shown in milliseconds. Optional, defaults to 3000 (3 sec).

Styling

The messagebox can be styled with CSS, see the css file for details.

License

Leaflet.Messagebox is free software. Please see LICENSE for details.

Misc

Alternatives names of the plugin: Leaflet notifications and Leaflet alerts

About

A Leaflet plugin to display a temporary message on a map

Resources

License

Stars

Watchers

Forks

Packages

No packages published