【发布时间】:2012-07-31 05:26:01
【问题描述】:
如何手动触发 Leaflet 多边形上的原生弹出窗口?
我可以像这样将原生弹出窗口绑定到每一层:
geojsonLayer.on("featureparse", function (e){
// bind the native popup
var popupContent = "popup content goes here";
e.layer.bindPopup(popupContent);
});
我已经为每个多边形手动分配了一个 ID,以便以后可以像这样引用它们:
map._layers['poly0']
我试过像这样触发弹出窗口:
map._layers['poly0'].openPopup();
但这给了我这样的错误:
map._layers['poly0'].openPopup is not a function
知道我哪里出错了吗?
【问题讨论】:
-
我在这里回答了我自己的问题:stackoverflow.com/questions/11421127/…
标签: leaflet