Leaflet 单张驾驶活动

Leaflet 单张驾驶活动,leaflet,Leaflet,我试图在使用鼠标滚轮时触发事件: map.on('mousewheel', function() { alert('foo'); }); 但这似乎不起作用,“轮子”也不起作用。有什么想法吗?你可以从地图容器上的鼠标滚轮事件中获得灵感并聆听。比如: L.DomEvent.on(map.getContainer(), 'mousewheel', function() { console.log("zoom", map.getZoom()) }); 还有一个演示 var-map

我试图在使用鼠标滚轮时触发事件:

map.on('mousewheel', function() {
    alert('foo');
 });

但这似乎不起作用,“轮子”也不起作用。有什么想法吗?

你可以从地图容器上的
鼠标滚轮
事件中获得灵感并聆听。比如:

L.DomEvent.on(map.getContainer(), 'mousewheel', function() {
    console.log("zoom", map.getZoom())
});
还有一个演示

var-map=L.map('map').setView([35.772219,-78.675272],10);
on(map.getContainer(),'mousewheel',function(){
console.log(“zoom”,map.getZoom())
});


不,那是谷歌地图,不是传单。是的,没错,我想发布同样的东西。