const coords = [
{
coord: [43.684345, -79.431292],
title: "Canada"
},
{
coord: [40.714599, -74.002791],
title: "USA"
},
{
coord: [-33.873603, 151.211858],
title: "Australia"
},
{
coord: [30.065993, 31.266061],
title: "Egypt"
},
{
coord: [25.195128, 55.27846],
title: "Dubai"
}
];
ymaps.ready(function() {
const map = new ymaps.Map("map", {
zoom: 11,
center: coords[0].coord,
controls: []
});
coords.forEach(n =>
map.geoObjects.add(
new ymaps.Placemark(n.coord, {
iconLayout: "default#image",
iconImageHref: "../img/mark.png",
iconImageSize: [46, 46]
})
)
);
document.querySelector("#mapBtns").innerHTML = coords
.map(
n =>
`${
n.title
}`
)
.join("");
});
-
Вопрос задан
-
40 просмотров