+ var MapPositionControl = L.Control.extend({
+ options: {
+ position: 'bottomright'
+ },
+
+ onAdd: function (map) {
+ var container = L.DomUtil.create('div', 'my-custom-control');
+
+ $(container).text('show map bounds').addClass('leaflet-bar btn btn-sm btn-default').on('click', function(e){
+ e.preventDefault();
+ e.stopPropagation();
+ $('#map-position').show();
+ $(container).hide();
+ });
+ $('#map-position-close a').on('click', function(e){
+ e.preventDefault();
+ e.stopPropagation();
+ $('#map-position').hide();
+ $(container).show();
+ });
+
+ return container;
+ }
+ });
+
+ map.addControl(new MapPositionControl());