[英]Google map pan controls shown but not working (on mobile)
I need to disable draggable
option for my Google Map and activate pan contols, so user can view map properly on mobile devices. 我需要为我的Google地图禁用
draggable
选项并激活平移控制,以便用户可以在移动设备上正确查看地图。 So here is my options: 所以这是我的选择:
panControl: true,
draggable: false
Pan controls are appearing on a map but it seems deactivated. 平移控件出现在地图上,但似乎已停用。 How can I activate it?
我该如何激活它? I also have marker and infoWindow, I don't know if it affects on a pan, so here full map code:
我也有标记和infoWindow,我不知道它是否会影响平底锅,所以这里有完整的地图代码:
function initMap() {
var latLng = new google.maps.LatLng( myloc , myloc ),
options = {
zoom: 15,
center: latLng,
panControl: true,
draggable: false,
zoomControl: true,
streetViewControl: !1,
mapTypeControl: !1,
scrollwheel: !1,
},
mapContainer = document.getElementById("map"),
map = new google.maps.Map(mapContainer, options),
marker = new google.maps.Marker({
position: latLng,
map: map,
icon: "/img/map-marker.png"
}),
infoWindowContent = '<div class="infowindow">My Info</div>',
infoWindow = new google.maps.InfoWindow({
content: infoWindowContent
});
infoWindow.open(map, marker), google.maps.event.addListener(marker, "click", function() {
infoWindow.open(map, marker)
}), google.maps.event.addDomListener(window, "resize", function() {
map.setCenter(latLng)
});
}
$(document).on('touchstart', 'div[title*=Mover]', function () {
$(this).trigger('click');
return false;
});
Change "Mover" to "Pan" or whatever the Pan command is called on the language you're using on your GMaps script. 将“ Mover”更改为“ Pan”或将您在GMaps脚本上使用的语言调用Pan命令。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.