Monday, 31 August 2015

css - Leaflet layer control and legend


I have a layer control with 8 layers in it. I also have a legend control in lower right. A few layers have the legend tall. Now my issue is on smaller monitors the legend control is on top of the layer control, making it hard to turn on/off layers.


I've looked at panes but didn't see a reference to either control, so I've played with CSS and tried to set the z-index but with no luck. I'm sure it can be done as the legend know how to draw on top of the layer control but where is the setting?


.leaflet-control-layers{ z-index: 500; } .legend { z-index: 100; }



Answer



The leaflet.css file contains a .leaflet-control {z-index: 800}. Probably the legend is in the bottom and the layer control is in another position, so you can override the CSS with z-index: new_index !important in .leaflet-top{} or .leaflet-bottom{}.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...