shahjagat
asked on
Google maps right click event error
Hi,
I am trying to add a right click event to the google maps. I cannot see alert with the geocodes.
I am not sure what to change.
I am trying to add a right click event to the google maps. I cannot see alert with the geocodes.
I am not sure what to change.
var map;
var directionsDisplay;
var directionsService = new google.maps.DirectionsService();
function initialize() {
directionsDisplay = new google.maps.DirectionsRenderer();
var mapOptions = {
zoom: 8,
center: new google.maps.LatLng(-34.397, 150.644),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('mapsGoogle'),
mapOptions);
directionsDisplay.setMap(map);
directionsDisplay.setPanel(document.getElementById('directions-panel'));
HomeTestMarker();
}
google.maps.event.addListener(map, 'rightclick', function(event ) {
var lat = event.latLng.lat();
var lng = event.latLng.lng();
alert("Lat=" + lat + "; Lng=" + lng);
});
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
for click on the map, yes
ASKER
thanks
ASKER
Do you need to have all the events inside initialize?