Quantcast
Channel: Question and Answer » leaflet
Viewing all articles
Browse latest Browse all 198

Displaying click results in a side panel

$
0
0

I am trying to do something similar to the interactive choropleth map (http://leafletjs.com/examples/choropleth.html) on leaflet’s website.

In my case I want to use a click instead of a hover and want to show the results in a side panel (i.e. separate div).

Can someone point me to an example or suggest how I can do this?

UPDATE:
Based on Bronco’s reply:

That part I understand. It is this snippet that I need to change but I don’t know how:

var info = L.control();

info.onAdd = function (map) {
this._div = L.DomUtil.create('div', 'info'); // create a div with a class "info"
this.update();
return this._div;
};

// method that we will use to update the control based on feature properties passed
info.update = function (props) {
this._div.innerHTML = 'US Population Density' + (props ? '' + props.name + '
' + props.density + ' people / mi2'
: 'Hover over a state');
};
info.addTo(map);

Viewing all articles
Browse latest Browse all 198