【发布时间】:2014-08-23 01:08:47
【问题描述】:
我的传单地图有问题。我的地图上有一些标记,单击一个时,标记居中。现在我想在单击一个标记时它不仅居中而且我想放大标记。当我添加这个
map.setZoom((16), {animate: true});
到
map.on('popupopen', function(centerMarker) {
var cM = map.project(centerMarker.popup._latlng);
cM.y -= centerMarker.popup._container.clientHeight/2
map.setZoom((16), {animate: true});
map.panTo(map.unproject(cM),{animate: true});
});
我的代码居中并没有真正起作用,因为它放大了但它没有使标记居中。但如果我处于预期的缩放级别 (16),所有其他标记都会居中。如果我不在缩放级别 16 之外,我该怎么做才能使地图缩放到标记并且标记也居中?我对传单和 jquery 很陌生...
【问题讨论】: