有没有办法检测用户何时单击默认的全屏模式按钮?
这些是我正在使用的 map 选项:
var mapOptions = {
center: {
lat: 40.907192,
lng: 20.036871
},
zoom: 2,
fullscreenControl: true
};
最佳答案
DaveBurns 的答案进行了一些修改,因为我不使用 jQuery。我还需要使用 clientHeight 和 clientWidth
window.google.maps.event.addListener(
map,
'bounds_changed',
onBoundsChanged,
);
function onBoundsChanged() {
if (
map.getDiv().firstChild.clientHeight === window.innerHeight &&
map.getDiv().firstChild.clientWidth === window.innerWidth
) {
console.log('FULL SCREEN');
} else {
console.log('NOT FULL SCREEN');
}
}
关于google-maps - Google Maps API v3 - 如何检测 map 何时更改为全屏模式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39620850/