How to change the marker on hovering Yandex map?

  • 0
    Several markers are used on the map, when hovering, the icon changes, if you open the balloon and move the cursor over another mark and take 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'
          });
        }
      });


    JavaScript Samuel Foster, Nov 29, 2019

  • 1 Answers
  • 0
    You have it in the condition and it is written, if the mouse leaves, and the balloon is open, then do nothing.
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!