Is there a way to Fix a Google Maps Marker to the Center of its Map always?

前端 未结 7 1367
野趣味
野趣味 2020-12-01 00:21

To be more precise, what I try to accomplish is that while I Drag a Google Map there\'s a Google Maps Marker that stays fixed

7条回答
  •  暖寄归人
    2020-12-01 00:58

    You can use google map drag event:

    google.maps.event.addListener(map, 'dragend', function() {
        marker.setPosition(map.getCenter()); 
    } );
    

提交回复
热议问题