E
E
evans852019-03-17 22:29:24
Yandex maps
evans85, 2019-03-17 22:29:24

How to make a link follow after clicking on a label?

var myPlacemark = new ymaps.Placemark(
    [56.315695, 44.017063], {
        hintContent: 'Оперный театр'
    }, {
        hasBalloon: false,
        href: 'Afgan.html'
    }, {
        iconImageHref: 'http://webmap-blog.ru/files/gmap/gicon/mm_20_red.png', // 
        iconImageSize: [12, 20],
        iconImageOffset: [-6, -10]
});
marker.events.add('click', function (e) {
    location = e.get('target')
        .options.get('href');
});
myMap.geoObjects.add(marker);
myMap.geoObjects.add(myPlacemark);


It is not possible to make your label design and follow the link immediately in place. What do you advise?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-03-17
@evans85

If you formatted your code properly, you might notice that the icon settings are passed to the Placemark constructor as the fourth parameter, which is wrong. There must be a third.
And, well, still not enough iconLayout: 'default#image'.
UPD. Taken from the comments:
can

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question