how can I get my custom markers to show?
I have got my code in place, everything works except, doesn't show my
custom marker?!
here is my code:
[code]
<script type="text/javascript">
//<![CDATA[
if (GBrowserIsCompatible()) {
// A function to create the marker and set up the event window
// Dont try to unroll this function. It has to be here for the
function closure
// Each instance of the function preserves the contends of a
different instance
// of the "marker" and "html" variables which will be needed
later when the event triggers.
function createMarker(point,html) {
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
marker.image = "images/google-pin.png";
marker.shadow = "images/google-pin-shadow.png";
marker.iconSize = new GSize(90, 70);
marker.shadowSize = new GSize(90, 70);
markerOptions = { icon:marker };
});
return marker;
}
// Display the map, with some controls and set the initial
location
var map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(51.3992613899243,-1.32983778443008),
8);
// Set up three markers with info windows
var point = new GLatLng(51.4769752333875,-2.53517458867092);
var marker = createMarker(point,'<div style="width:240px">Some
stuff to display in the First Info Window. With a <a href="http://
www.econym.demon.co.uk">Link<\/a> to my home page<\/div>')
map.addOverlay(marker);
var point = new GLatLng(50.8391656924497,-0.154312843280554);
var marker = createMarker(point,'Some stuff to display in
the<br>Second Info Window')
map.addOverlay(marker);
var point = new GLatLng(50.8340528225749,-0.259947032613667);
var marker = createMarker(point,'Some stuff to display in
the<br>Third Info Window')
map.addOverlay(marker);
var point = new GLatLng(51.5168824045344,-2.6926718990779);
var marker = createMarker(point,'Some stuff to display in
the<br>Third Info Window')
map.addOverlay(marker);
var point = new GLatLng(50.954582894922,-0.145016932400171);
var marker = createMarker(point,'Some stuff to display in
the<br>Third Info Window')
map.addOverlay(marker);
}
// display a warning if the browser was not compatible
else {
alert("Sorry, the Google Maps API is not compatible with this
browser");
}
// This Javascript is based on code provided by the
// Community Church Javascript Team
// http://www.bisphamchurch.org.uk/
// http://econym.org.uk/gmap/
//]]>
</script>
[/code]
--
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en.