当点击标记时,我希望能够放大地图上的标记。我正在使用Mapbox和leaflet。
我尝试了如下代码:
marker.on('click', function(e){
map.setView([e.lat, e.lng], 12);
});
但是它给了我一些错误:
类型错误:t为空
我甚至尝试过:
marker.on('click', function(e){
map.fitBounds(marker.getBounds());
});
当点击标记时,我希望能够放大地图上的标记。我正在使用Mapbox和leaflet。
我尝试了如下代码:
marker.on('click', function(e){
map.setView([e.lat, e.lng], 12);
});
但是它给了我一些错误:
类型错误:t为空
我甚至尝试过:
marker.on('click', function(e){
map.fitBounds(marker.getBounds());
});
marker.on('click', function(e){
map.setView(e.latlng, 13);
});
尝试
marker.on('click', function(e){
map.setView([e.latlng.lat, e.latlng.lng], 12);
});