maps - Open a popover with by ID - Mapbox -
in mapbox creating overlays using following code within map creation function - http://jsfiddle.net/shanejones/3ajankv9/
i need work out way open popover it's id in separate function.
using post here have modified following example should open layer id 1.
function next(next_id){ map.featurelayer.eachlayer(function(marker) { if (marker.feature.properties.id == marker_id) { marker.openpopup(); } }); }
but give me undefined error know i'm going wrong here?
edit - show error when run above function console.
thanks
i ran problem in past. ended doing this, it's not best solution may out.
map.featurelayer.eachlayer(function(marker) { if (marker.feature.properties.id == marker_id) { marker.fireevent('click', { latlng: { lat: marker._latlng.lat, lng: marker._latlng.lng } }); } });
Comments
Post a Comment