I am trying to add a custom marker to my google api: works fine except when I click on that marker, I have no event any more:
var map = new GMap2(document.getElementById("map_canvas")); map.setCenter(new GLatLng(0, 0), 5); map.addControl(new GLargeMapControl3D()); map.addControl(new GMenuMapTypeControl()); var myIcon = new GIcon(G_DEFAULT_ICON); myIcon.image = "http://farm3.staticflickr.com/2140/1911601567_49d97f3318.jpg"; myIcon.iconSize = new GSize(80, 60); markerOptions={}; //markerOptions = { icon:myIcon }; // if I uncomment this : no click anymore var bounds = map.getBounds(); var southWest = bounds.getSouthWest(); var northEast = bounds.getNorthEast(); var lngSpan = northEast.lng() - southWest.lng(); var latSpan = northEast.lat() - southWest.lat(); var point = new GLatLng(southWest.lat() + latSpan * Math.random(), southWest.lng() + lngSpan * Math.random()); var marker = new GMarker(point, markerOptions); marker.html = 'hello world'; map.addOverlay(marker); GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(marker.html); }) If I uncomment //markerOptions = { icon:myIcon };
I have my photo displayed, but I cannot click on marker any more.
Someone can help me? You can see it working on http://www.roulette-chat.fr/google.php.
Regards