【发布时间】:2014-09-05 21:44:19
【问题描述】:
我想在一页上有多个 mapquest 传单地图,但是在传单中,您必须像这样使用 div 中给出的 id 创建地图
<div style="color:black ;" id="map"></div>
然后
plugin.Map = new L.Map('map', {//<the id is used here
layers : [mapLayer],
center: new L.LatLng(39.828127,-98.579404),
boxZoom: true,
zoom: 5
});
但是我想知道如果我有多个 div 是否可以获取 id,例如:
<div style="color:black; " id="map"></div>
<div style="color:black ;" id="map2"></div>
然后我就可以打电话了
L.Map('map'...//where this is a possible array or something...
我不能只将 id 放入自己的原因是我创建了一个模板,我想这样做而不用硬编码任何东西......
【问题讨论】:
标签: javascript html leaflet