如何将事件侦听器添加到“+”缩放元素?
How add event listener to '+' zoom element?
当他的状态被禁用时,我尝试将事件侦听器添加到“+”缩放元素图标。请帮助我。
代码:
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')
});
};
这个解决方法怎么样?
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')
}
})
}
});
当他的状态被禁用时,我尝试将事件侦听器添加到“+”缩放元素图标。请帮助我。
代码:
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')
});
};
这个解决方法怎么样?
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')
}
})
}
});