When adding a marker to a google v3 map, I want to automatically begin dragging it. Th开发者_开发知识库e click event that adds the marker is already on the canvas, and so I want the same click event that adds the marker to also act as a drag start. Very similar to how it's done when adding markers to a Google MyMaps map (though I'm pretty sure that still uses V2).
Is this possible, or do I have to add the marker, then make it follow the mouse around until the user clicks again, then drop?
Add "draggable: true," to the marker's options.
Example:
marker = new google.maps.Marker({
draggable: true,
position: somepoint,
});
marker.setMap(map);
Not sure if adding draggable: true to the marker is what your looking fOr or if it is beyond that? Hope this helps
精彩评论