我正在使用最新的 LeafletJS 库在地图上显示带有某些弹出选项的弹出窗口。
它在 Firefox 和 Chrome 中运行良好,但在 IE8 中失败并显示错误消息:
无效的论点。Leaflet.js,第 6 行,字符 14452
这是:
i=Math.min(i,this.options.maxWidth),i=Math.max(i,this.options.minWidth),e.width=i+1+"px",e.whiteSpace="",e.height=""
问题显然似乎与popupOptions 声明有关——取消注释它们时,IE8 中不会出现 js 错误,但当然也不会应用这些选项。
所以我想知道,语法有什么问题?
function onEachFeature(feature, layer) {
var popupContent = '...';
if (feature.properties && feature.properties.popupContent) {
popupContent += feature.properties.popupContent;
}
var popupOptions =
{
'minWidth': '491px',
'maxWidth': '491px',
'closeButton': false
}
layer.bindPopup(popupContent, popupOptions);
}