<script>
function initialize() {
var crosshairShape = {coords:[0,0,0,0],type:'rect'};
var mapCanvas = document.getElementById('map');
var mapOptions = {
center: new google.maps.LatLng(23.634501, -102.552784),
zoom: 5,
scrollwheel: false,
panControl: false,
zoomControl: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(mapCanvas, mapOptions);
var marker = new google.maps.Marker({
map: map,
});
marker.bindTo('position', map, 'center');
//marker.bindTo('position', map, 'center');
map.addListener('dragend', function() {
var Newlat = position.coords.latitude;
console.log(Newlat);
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
This is the code I'm using to make a draggable map with a marker in the origin. I can't seem to get the latitude and longitude of the position where the marker was left. Anybody can help me?