How can I use a Google map with a drag marker (drag marker) on the touch screens of a mobile browser?

In a desktop browser, everything works well using drag and drop, but not for touch screens. What do I need to do to enable marker dragging in mobile (tablet and phone) browsers?

map = new google.maps.Map(document.getElementById('map_canvas'),
                mapOptions);
 google.maps.event.addListener(map, 'center_changed', function() {
   window.setTimeout(function() {
      map.panTo(marker.getPosition());
     }, 3000);
  }); 


        marker = new google.maps.Marker({
          map:map,
          draggable: true,
          animation: google.maps.Animation.DROP,
          position: parliament,
          icon: psrimage
        }); 
+5
source share

All Articles