M
M
Maxim Filippov2014-09-06 13:17:21
Yandex
Maxim Filippov, 2014-09-06 13:17:21

How to make a label a link to another page on Yandex.Maps?

I place a lot of markers on the map and each of the markers I set my own link. The task is to click on the label not to open the balloon, but to follow the given link. I'm trying to solve using a GeoObject with the following properties:

iconLayout: "default#imageWIthContent"
iconContentLayout: ymaps.templateLayoutFactory.createClass "<a style='display: block; width: 40px; height: 40px; background: #ccc' href='" + post.url + "'></a>"

However, when clicking on the link, the transition does not occur. There is a suspicion that Yandex.Map intercepts the event and prevents it from propagating to the link. Any ideas how to fix this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Petrov, 2014-09-06
@colix

You don't need to use a balun at all.

var marker = new ymaps.Placemark(
  //координаты
  {
    ...
  },
  {
    hasBalloon: false,
    href: 'http://google.ru/'
    ...
  }
);
marker.events.add('click', function (e) {
  location = e.get('target').options.get('href');
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question