I
I
Ibishka2020-01-05 21:27:38
Yandex maps
Ibishka, 2020-01-05 21:27:38

Why doesn't the label image change?

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("");
});

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question