How to Add/Remove Legend with Leaflet Layers Control?

المشرف العام

Administrator
طاقم الإدارة
I have two overlays http://02d0c8c.netsolhost.com/dev/lcb_census_layers3.html that can be turned on and off with a Layer Control. I’d like the legend for each layer to turn on/off along with the layers.

I am new to JavaScript and new to Leaflet.

Lake Champlain Basin Census Data #map { width: 750px; height: 580px; } .info { padding: 6px 8px; font: 14px/16px Verdana, Geneva, sans-serif; background: white; background: rgba(255,255,255,0.8); box-shadow: 0 0 15px rgba(0,0,0,0.2); border-radius: 5px; } .info h4 { font-family: Verdana, Geneva, sans-serif; margin: 0 0 5px; color: #065581; } .legend { line-height: 18px; color: #555; } .legend i { width: 18px; height: 18px; float: left; margin-right: 8px; opacity: 0.7; }


أكثر...
 
أعلى