我的网站使用谷歌地图,但我无法在 map 上看到全屏功能。如何激活以及为什么看不到它?
我向 map 添加了以下选项:
var map = new google.maps.Map(document.getElementById('googleMap'), {
zoom: 7,
center: new google.maps.LatLng(this.coordinates[0][1], this.coordinates[0][0]),
mapTypeId: google.maps.MapTypeId.ROADMAP,
zoomControl: true,
scaleControl: true,
zoomControlOptions: {
position: google.maps.ControlPosition.LEFT_TOP
}
});
最佳答案
默认情况下,桌面版 Google Maps API 中不包含全屏控件。将 fullscreenControl: true
属性添加到用于初始化 map 的对象。您的代码应如下所示:
var map = new google.maps.Map(document.getElementById('googleMap'), {
zoom: 7,
center: new google.maps.LatLng(this.coordinates[0][1], this.coordinates[0][0]),
mapTypeId: google.maps.MapTypeId.ROADMAP,
zoomControl: true,
scaleControl: true,
fullscreenControl: true
zoomControlOptions: {
position: google.maps.ControlPosition.LEFT_TOP
}
});
查看文档:https://developers.google.com/maps/documentation/javascript/controls
关于javascript - Google map 全屏选项被禁用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46748036/