1
1
1ss1za2020-11-06 11:28:37
JavaScript
1ss1za, 2020-11-06 11:28:37

How to change the marker when hovering Yandex map?

Several markers are used on the map, when hovering the icon changes, if you open the balloon and hover over another marker and move it back, it does not change

objectManager.events
  .add(['mouseenter'], function (e) {
    objectManager.objects.setObjectOptions(e.get('objectId'), {
      preset: 'mark-hover#icon'
    });
  })
  .add(['mouseleave'], function (e) {
    if (!myMap.balloon.isOpen(e.get('objectId'))) {
      objectManager.objects.setObjectOptions(e.get('objectId'), {
        preset: 'mark#icon'
      });
    }
  });


5fa50927861e4928342252.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2020-11-06
@freeExec

You have it in the condition and it is written, if the mouse leaves, and the balloon is open, then do nothing.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question