Simplify sidebar/resize

Float sidebars left/right and use overflow: hidden.
Fixes a bug on Opera where mouse events propagate to
the map.
This commit is contained in:
John Firebaugh 2013-07-12 12:17:51 -07:00
parent d9f3ceed95
commit aff23d4b4b
11 changed files with 27 additions and 120 deletions

View file

@ -1,7 +1,13 @@
L.OSM.sidebar = function(selector) {
var control = {},
sidebar = $(selector),
current = $();
current = $(),
map;
control.addTo = function (_) {
map = _;
return control;
};
control.addPane = function(pane) {
pane
@ -10,25 +16,23 @@ L.OSM.sidebar = function(selector) {
};
control.togglePane = function(pane) {
var controlContainer = $('.leaflet-control-container .leaflet-top.leaflet-right');
current
.hide()
.trigger('hide');
if (current === pane) {
$(sidebar).hide();
controlContainer.css({paddingRight: '0'});
current = $();
} else {
$(sidebar).show();
controlContainer.css({paddingRight: '250px'});
current = pane;
}
current
.show()
.trigger('show');
map.invalidateSize({pan: false, animate: false});
};
return control;