I am using google maps on my web site. It works perfectly fine in all browsers, however I have problem using it on mobile: I cannot scroll the map. I am suspecting that it is caused by eventListener “click”, might it be the case? I am placing marker in the place where user clicked.
Here is the code:
<script src="http://maps.google.com/maps/api/js?sensor=false&language=${Locale.getDefault()}" type="text/javascript"></script>
$(document).ready(function(){
createMap();
});
function createMap(){
geocoder = new google.maps.Geocoder();
infowindow = new google.maps.InfoWindow();
latlng = new google.maps.LatLng(55.783234,12.518363);
var myOptions = {
zoom: 7,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
marker = new google.maps.Marker();
google.maps.event.addListener(map, 'click', function(event) {
makeMarker(event.latLng, true);
});
}
It turns out it’s not a very good idea to use Google Maps on a mobile device.