Tuesday, 25 August 2015

carto - Moving legend with CartoDB.js?


I'm wondering if it's possible to move the position of legend when using CartoDB.js.


I can see in the layer api I can turn it on or off, but ideally I'd like to be able to specify a div for it to be nested within. Is this possible?



Answer



As a workaround I've decided to just use jquery to shuffle the div from one spot to another using the following


$(".cartodb-legend-stack").detach().appendTo('#newDiv');

This seems to work reasonably well, obviously not ideal but a pretty good substitute.


No comments:

Post a Comment