Hello! I have some problems combining a custom marker icon with my infoWindow.
Here is my js code:
var micon = new GIcon();
micon.image = "/path/to/my/icon.png";
micon.iconSize = new GSize(25, 17);
micon.iconAnchor = new GPoint(25, 17);
markerOptions = {
icon:micon
}
var point = new GLatLng(48.092757,11.645508);
var marker = new GMarker(point, markerOptions)
map2.addOverlay(marker);
This is working. I get my marker at the right position with my custom icon. Now I want to add an infowindow to my marker, so I added
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml('Some text');
});
right after my var marker = new GMarker(point, markerOptions)
Now, on clicking my custom icon, I get an error (at firebug) called:
a is undefined
When removing my markerOptions at new Marker(), it works (but without my custom icon)
var marker = new GMarker(point, markerOptions);
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml('Some text');
});
map2.addOverlay(marker);
to
var marker = new GMarker(point);
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml('Some text');
});
map2.addOverlay(marker);
What's wrong with my code?