0

I try add event listener to '+' zoom element icon when him state is disabled. please help me.

JSFIDDLE here.

code:

ymaps.ready(init);

var myMap,
    collectionMarkers,
    currCoords = [55.76, 37.64];

function init(){     
    myMap = new ymaps.Map("map", {
        center: currCoords,
        zoom: 18
    });  

    const zoomControl = new window.ymaps.control.ZoomControl();
    myMap.controls.event.add('disabled', () => {
        console.log('+ is disable')
    });
};
rettoryh13
  • 135
  • 1
  • 6
  • The zoom element has the class `ymaps-2-1-68-zoom__icon`, so maybe you can add the listener on that class? – Dennis Aug 01 '18 at 12:31

1 Answers1

1

What about this workaround?

myMap.events.add('boundschange', function(event) {
  if (event.get('newZoom') !== event.get('oldZoom')) {
    myMap.layers.getZoomRange().then(function(zoomRange) {
      if (event.get('newZoom') === zoomRange[1]) {
        console.log('+ is disable')
      }
    })
  }
});  

http://jsfiddle.net/0tw3qryh/

se0ga
  • 136
  • 2