【发布时间】:2016-07-03 13:23:42
【问题描述】:
我正在尝试在传单弹出窗口中包含图片,但弹出窗口大小无法适应图片大小。我在 github 上找到了解决方案:
https://github.com/Leaflet/Leaflet/issues/724
虽然该解决方案修复了弹出窗口的大小,但结果会发生变化,并且弹出窗口不会显示在图标/标记的中心...有什么办法可以改变吗?
.leaflet-popup-content {
width:auto !important;
}
在我的情况下,其他建议的解决方案(在弹出窗口上设置 maxWidth)也无济于事。弹出窗口宽度保持为默认宽度 300px...
function pop_Fotos(feature, layer) {
var popupContent = '<img style="max-height:500px;max-width:500px;" src="...");
layer.bindPopup(popupContent, {maxWidth: 500, closeOnClick: true});
}
【问题讨论】:
标签: javascript leaflet