我在地图框周围弄乱我的头,但无论我在这里做什么都是我的代码,标记都不可见
map.on('dblclick', function (e) {
var el = document.createElement('div');
el.setAttribute("style","width: 25px,height: 25px,border-radius: 50%,border:1px solid gray,background-color:lightblue");
var letcoordinates = [e.lngLat.lng, e.lngLat.lat];
// make a marker for each feature and add to the map
debugger
new mapboxgl.Marker(el)
.setLngLat(letcoordinates)
.addTo(map);
});
我不知道我做错了什么
提前致谢
答案 0 :(得分:1)
在setAttribute()
中,属性应以分号分隔:
el.setAttribute("style","width: 25px;height: 25px;border-radius: 50%;border:1px solid gray;background-color:lightblue");