1

When adding a marker to a google v3 map, I want to automatically begin dragging it. The 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?

2 Answers 2

2

Add "draggable: true," to the marker's options.

Example:

marker = new google.maps.Marker({ draggable: true, position: somepoint, }); marker.setMap(map); 
Sign up to request clarification or add additional context in comments.

Comments

0

Not sure if adding draggable: true to the marker is what your looking fOr or if it is beyond that? Hope this helps

1 Comment

Marker is draggable. It just takes 2 clicks. 1 to add marker, second to start dragging it. Want to immediately drag on first click.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.