Layer Radio control with interaction

by Muhammad Muzaffar

HTML

<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.0/dist/leaflet.css">
<link rel="stylesheet" href="https://ismyrnow.github.io/Leaflet.groupedlayercontrol/src/leaflet.groupedlayercontrol.css">
<script src="https://unpkg.com/leaflet@1.0.0/dist/leaflet-src.js"></script>
<script src="https://ismyrnow.github.io/Leaflet.groupedlayercontrol/src/leaflet.groupedlayercontrol.js"></script>
<div id='map'></div>

CSS

#map {
      width:600px;
      height:400px;
    }

JavaScript

var blocks1995 =
    {
    "type": "FeatureCollection",
    "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
    "features": [
    { "type": "Feature", "properties": { "time": 1995, "density": 3.1, "nameB": "BlockA"}, "geometry": { "type": "Polygon", "coordinates": [ [ [ 50.0, 29.0 ], [ 50.0, 29.99], 
                                                                                                                                              [50.51, 29.99], [ 50.0, 29.0 ] ] ] } },
    { "type": "Feature", "properties": { "time": 1995, "density": 1.1, "nameB": "BlockB"}, "geometry": { "type": "Polygon", "coordinates": [ [ [ 50.01, 30.0 ], [ 50.52, 30.0],[50.52, 30.5] ] ] } }
    ]
    };

    
    
    var blocks1996 =
    {
    "type": "FeatureCollection",
    "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
    "features": [
    { "type": "Feature", "properties": { "year": 1996, "density": 2.2, "name": "BlockA"}, "geometry": { "type": "Polygon", "coordinates": [ [ [ 50.0, 29.0 ], [ 50.0, 29.99], [50.51, 29.99] ] ]  } },
    { "type": "Feature", "properties": { "year": 1996, "density": 1.2, "name": "BlockB"}, "geometry": { "type": "Polygon", "coordinates": [ [ [ 50.01, 30.0 ], [ 50.52, 30.0],[50.52, 30.5] ] ] } }
    ]
    };


    var blocks1995Layer = L.layerGroup([ L.geoJson(blocks1995)]),
        blocks1996Layer = L.layerGroup([ L.geoJson(blocks1996)]);
    
    
    var overlayMaps =  {"Blocks 1995": blocks1995Layer,
					"Blocks 1996": blocks1996Layer
					};
    
     var groups = {
    cities: new L.LayerGroup(),
    restaurants: new L.LayerGroup()
  };
  
   // Overlay layers are grouped
    var groupedOverlays = {
      "Landmarks": {
        "Cities": groups.cities,
        "Restaurants": groups.restaurants
      }
    };

    var options = {
      // Make the "Landmarks" group exclusive (use radio inputs)
      exclusiveGroups: ["Landmarks"],
      // Show a checkbox next to...