user3599212 user3599212 - 5 months ago 53
jQuery Question

having any options for circle click event on map and marker as visible false

function setCircleMap(lat,lng,Diameter){
// lat,lng,diameter get values from Server
var myLatLng = new google.maps.LatLng(lat, lng);
var mapOptions = {
center: myLatLng,
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: true,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
},
zoomControl: true,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.LARGE,
position: google.maps.ControlPosition.RIGHT_CENTER
},
panControl: true,
panControlOptions: {
position: google.maps.ControlPosition.RIGHT_CENTER
}
};
map = new google.maps.Map(document.getElementById("circleMap-canvas"), mapOptions);
google.maps.event.addListener(map, "idle", function(){
google.maps.event.trigger(map, 'resize');
});
var circleOptions = {
strokeColor: "#FF0000",
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: "#FF0000",//32EBEB
fillOpacity: 0.35,
map: map,
center: new google.maps.LatLng(lat, lng),
radius: parseInt(Diameter,10)
};
AOICircle = new google.maps.Circle(circleOptions);



  • from above code i got the circle on map,

  • but now i tried click on circle i need to get circle latitude,longitude values,

  • i tried with this code,

    google.maps.event.addDomListener(AOICircle ,"click",function(e){
    alert("clicked")//not get any alert
    });

  • is circle having event click option in v3-API,

  • if give solution very helpfull for me.


Answer

use google.maps.event.addListener (not addDomListener) on a google.maps.Circle.

google.maps.event.addListener(AOICircle ,"click",function(e){
        alert("clicked")
});

working fiddle

Comments