openstreetmap-website/app/assets/javascripts/leaflet.sidebar.js
John Firebaugh aff23d4b4b Simplify sidebar/resize
Float sidebars left/right and use overflow: hidden.
Fixes a bug on Opera where mouse events propagate to
the map.
2013-07-18 10:45:18 -07:00

39 lines
641 B
JavaScript

L.OSM.sidebar = function(selector) {
var control = {},
sidebar = $(selector),
current = $(),
map;
control.addTo = function (_) {
map = _;
return control;
};
control.addPane = function(pane) {
pane
.hide()
.appendTo(sidebar);
};
control.togglePane = function(pane) {
current
.hide()
.trigger('hide');
if (current === pane) {
$(sidebar).hide();
current = $();
} else {
$(sidebar).show();
current = pane;
}
current
.show()
.trigger('show');
map.invalidateSize({pan: false, animate: false});
};
return control;
};