Does anyone know why my Custom Marker Won't display? I am sure it's a
small syntax thing - But I can't find it.
THANKS!
- Nick
if (GBrowserIsCompatible()) {
// this variable will collect the html which will eventually be
placed in the side_bar
var side_bar_html = "";
// arrays to hold copies of the markers and html used by the
side_bar
// because the function closure trick doesnt work there
var gmarkers = [];
var htmls = [];
var i = 0;
// Create some custom icons
// This icon uses the same shape as the default Google marker
// So we can use its details for everything except the image
var blueIcon = new GIcon();
blueIcon.image = "http://cf.bigfatdesigns.com/clients/natss/
media/images/icon_college.png";
blueIcon.shadow = "http://cf.bigfatdesigns.com/clients/natss/
media/images/icon_shadow.png";
blueIcon.iconSize = new GSize(40, 38);
blueIcon.shadowSize = new GSize(40, 38);
blueIcon.iconAnchor = new GPoint(20, 17);
blueIcon.infoWindowAnchor = new GPoint(15, 15);
blueIcon.infoShadowAnchor = new GPoint(15, 15);
// This icon is a different shape, so we need our own
settings
var homeIcon = new GIcon();
homeIcon.image = "http://cf.bigfatdesigns.com/clients/natss/
media/images/icon_home.png";
homeIcon.shadow = "http://cf.bigfatdesigns.com/clients/natss/
media/images/icon_shadow.png";
homeIcon.iconSize = new GSize(40, 38);
homeIcon.shadowSize = new GSize(40, 38);
homeIcon.iconAnchor = new GPoint(20, 17);
homeIcon.infoWindowAnchor = new GPoint(15, 15);
homeIcon.infoShadowAnchor = new GPoint(15, 15);
// An array of GIcons, to make the selection easier
var icons = [];
icons[0] = blueIcon;
icons[1] = homeIcon;
// A function to create the marker and set up the event window
function createMarker
(point,icontype,tip,name,html1,html2,label1,label2) {
var marker = new GMarker(point, {title:tip}, icons
[icontype]);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml([new GInfoWindowTab(label1,html1),
new GInfoWindowTab(label2,html2)]);
});
// save the info we need to use later for the side_bar
gmarkers[i] = marker;
// add a line to the side_bar html
side_bar_html += '<a href="javascript:myclick(' +
(gmarkers.length-1) + ')">' + name + '<\/a><br>';
i++;
return marker;
}
// This function picks up the click and opens the corresponding
info window
function myclick(i) {
GEvent.trigger(gmarkers[i], "click");
}
<cfoutput>
// create the map
var map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl3D());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng( #ThisLat#, #ThisLong# ), 8);
var point = new GLatLng(#ThisLat#,#ThisLong#);
var marker = createMarker(point,
"homeIcon",
"Your Location",
"<strong>Your
Location</strong>",
"This is
the<br>location You Entered.",
"Nothing",
"Address",
"Special")
map.addOverlay(marker);
// add the points
<cfloop query="qryGetMap">
var point = new GLatLng
(#qryGetMap.LocationLat#,#qryGetMap.LocationLong#);
var marker = createMarker(point,
"blueIcon",
"#qryGetMap.LocationName#",
"<strong>#qryGetMap.LocationName#</strong><br><em>#Round
(qryGetMap.Distance)# Miles</em><br>",
"#qryGetMap.DealerID#<br> #qryGetMap.LocationName#<br>
#qryGetMap.LocationAddress#<br> #qryGetMap.LocationCity#",
"Store Stuff",
"Address",
"Special")
map.addOverlay(marker);
</cfloop>
Link: http://cf.bigfatdesigns.com/clients/natss/map-3.cfm
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
-~----------~----~----~----~------~----~------~--~---