Skip to content
JavaScript CSS
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE Update LICENSE Aug 23, 2013
README.md Update README.md Dec 13, 2013
icon-viewcenter.png Add plugin source Aug 23, 2013
index.html
leaflet.viewcenter.css Update leaflet.viewcenter.css Aug 28, 2013
leaflet.viewcenter.js Add plugin source Aug 23, 2013

README.md

endorse

leaflet.viewcenter

This is a simple extension of Leaflet.Control.Zoom that adds a change localization and zoom button above the zoom in and zoom out controls.

Checkout the demo.

USAGE

Be sure to include the leaflet.viewcenter.js script somewhere after Leaflet is loaded.

<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>

<link rel="stylesheet" href="leaflet.viecenter.css" />
<script src="leaflet.viewcenter.js"></script>

Do all your normal Leaflet initialization stuff, except make sure that you initialize the map without the default zoom controls:

<!-- map container -->
<div id="map"></div>

// init map
var map = new L.Map('map');

// init ViewCenter plugin
var viewCenter = new L.Control.ViewCenter();
map.addControl(viewCenter);

NOTES

This extension was built and tested for Leaflet version 0.6.4.

Bitdeli Badge

You can’t perform that action at this time.