Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,24 @@ L.control.groupedLayers(baseLayers, groupedOverlays, options).addTo(map);

![advanced preview](preview-advanced.png)

#### Collapsable Groups

Enabling collapsable groups in the switcher can be done with the following options

```javascript
var options = {
// enable basic collapsability
groupsCollapsable: true,
// (Optional) The css class(es) used to indicated the group is expanded
groupsExpandedClass: "glyphicon glyphicon-chevron-down",
// (Optional) The css class(es) used to indicated the group is collapsed
groupsCollapsedClass: "glyphicon glyphicon-chevron-right"
};
L.control.groupedLayers(baseLayers, groupedOverlays, options).addTo(map);
```

![collapsable preview](preview-collapsable.png)

### Adding a layer

Adding a layer individually works similarly to the default layer control,
Expand Down
Binary file modified preview-advanced.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 29 additions & 5 deletions src/leaflet.groupedlayercontrol.css
Original file line number Diff line number Diff line change
@@ -1,14 +1,38 @@
.leaflet-control-layers-group-name {
font-weight: bold;
margin-bottom: .2em;
font-weight: 700;
margin-bottom: 0.2em;
margin-left: 3px;
}

.leaflet-control-layers-group {
margin-bottom: .5em;
margin-bottom: 0.5em;
}

.leaflet-control-layers-scrollbar {
overflow-y: scroll;
padding-right: 10px;
}
.leaflet-control-layers-group-label {
margin-bottom: 2px;
}
.leaflet-control-layers-group-selector, .leaflet-control-layers-selector {
vertical-align: top;
}
.leaflet-control-layers-group label:not(.leaflet-control-layers-group-label) {
text-indent: 15px;
}
.leaflet-control-layers-group.group-collapsable.collapsed .leaflet-control-layers-group-collapse,
.leaflet-control-layers-group.group-collapsable:not(.collapsed) .leaflet-control-layers-group-expand,
.leaflet-control-layers-group.group-collapsable.collapsed label:not(.leaflet-control-layers-group-label){
display: none;
}
.leaflet-control-layers-group-expand-default:before{
content: "+";
width: 12px;
display: inline-block;
text-align: center;
}
.leaflet-control-layers-group-collapse-default:before{
content: "-";
width: 12px;
display: inline-block;
text-align: center;
}
Loading