Google maps moving marker on click

后端 未结 3 1217
情深已故
情深已故 2021-02-13 01:10

What I want to do is,

on my map, when I click somewhere on the map, it shows a marker on the point, then I click different point on the map then it shows a another mark

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-13 01:39

    Every time placemarker() is ran, it creates a new marker.

    You need to create the marker once outside of the placemarker function and after that, inside placemarker, use marker.setPosition().

提交回复
热议问题