Skip to content

Adds the maps center and zoom as a permalink and sets up browsing history

License

Notifications You must be signed in to change notification settings

hupe13/leaflet-permalink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Leaflet.Permalink

Adds the maps center and zoom as a permalink for Leaflet maps.

Initially based on the work of MarcChasse.

Features

  • works with Leaflet 1.9.4
  • Should work with all modern browsers
  • also works with asynchronously loaded elements
  • There may be a problem to detect the initial state if you have a slow loading website or an impatient user.

Quick Start

  1. Create a leaflet map. Checkout Leaflets Quick Start Guide for a basic map example.

  2. Download and include leaflet.permalink.min.js

	<script src="../leaflet.permalink.min.js"></script>
  1. Add the following code to the map initialization:
	// create map
	var map = new L.map(...);
	// call this
	map.whenReady ( function() {
		L.Permalink.setup(map);
	});

Complete Example

see here.

Checkout the DEMO.

Another Example

If you are using WordPress and the plugin Leaflet Map there is an example too.

About

Adds the maps center and zoom as a permalink and sets up browsing history

Resources

License

Stars

Watchers

Forks