Reputation: 1
My friend and I have a project we're trying to accomplish with using Google Maps. We want to be able to have people visit our website and add/drag a marker to anywhere on a custom google map. I've looked around a lot for something I could possibly mimic, but to no avail.
If someone could please help us. We also are not looking for someone to just give us the answer, but kind of steer us in the right direction. We would much rather learn how to do this, than for it to be handed to us.
Thanks!
Upvotes: 0
Views: 199
Reputation: 8819
Pretty simple, you can set an click event on the map that gives you the latitude and longitude of the click, and use that to create a marker. And when you do, set the draggable
property to true. That allows users to drag it around, and when it lands it will fire another event.
Some info that might be helpful: https://developers.google.com/maps/documentation/javascript/events https://developers.google.com/maps/documentation/javascript/overlays#Markers https://developers.google.com/maps/documentation/javascript/reference#Marker (check out events section)
Upvotes: 1