我目前正在使用leaflet.js,並且現在正在網上搜索相當多的東西,以查明:如果有事件,那麼可以在異步函數setView()的動畫結束後觸發該事件。leaflet.js:setView()完成動畫時觸發事件。這怎麼可能?
這是我的嘗試:
map.setView([lat, lon ], 12 , {
pan: { animate: true , duration: 0.5 },
zoom: { animate: true },
animate: true
}.on('ready', function(e) {
console.log("animation finished!");
});
的的setView命令的作品完美,但功能,應該在地圖動畫準備好了,不工作被解僱。
有沒有人有解決方案?
我認爲這是[once](http://leafletjs.com/reference-1.0.3.html#evented-once) – Jacob