如何检测Mapbox或Leaflet何时进入或退出全屏模式?
我发现this answer有人这么说:
文档说:
map.on('fullscreenchange', function () { if (map.isFullscreen()) { console.log('entered fullscreen'); } else { console.log('exited fullscreen'); } });
如果不起作用,请改用:
map.on('enterFullscreen', function(){ }); map.on('exitFullscreen', function(){ });
我试过了,以及事件类型参数的一些变体。没有骰子。
此外,the documentation并未提及此事件。
请注意,我使用的是Mapbox GL JS。
答案 0 :(得分:0)
这其实很简单。您不需要Leaflet或Mapbox中的任何内容。只需在文档对象上使用事件监听器即可。
onPress