Hi, I hope someone can help me out. I have tried different approaches to
changing this old V2 google map to the new version 3 but I keep having
issues getting the tabs to work in the info windows.
Here is my old V2 code if anyone can show/explain to me the correct way to
set this up i would so appreciate it. Thanks in advance.
function load() {
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);
});
return marker;
}
// Display the map, with some controls and set the initial location
var map = new GMap2(document.getElementById("map_canvas"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(54.525961, 15.255119),2);
// ==================================================
// A function to create a tabbed marker and set up the event window
// This version accepts a variable number of tabs, passed in the
arrays htmls[] and labels[]
function createTabbedMarker(point,htmls,labels) {
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
// adjust the width so that the info window is large enough for
this many tabs
if (htmls.length > 3) {
htmls[0] = '<div style="width:'+htmls.length*20+'px">' +
htmls[0] + '</div>';
}
var tabs = [];
for (var i=0; i<htmls.length; i++) {
tabs.push(new GInfoWindowTab(labels[i],htmls[i]));
}
marker.openInfoWindowTabsHtml(tabs);
});
return marker;
}
// ==================================================
// Set up markers with info windows
var point = new GLatLng(40.143105, 47.576927);
var marker = createMarker(point,'<div style="width:450px"><A
HREF="/aurora/archives/fall-2009/peace-corps/map/profiles/index.xml#tobin"><img
src="/aurora/archives/fall-2009/peace-corps/map/tobin_xsm.jpg" width="125"
height="167" hspace="3" vspace="0" align="right" /></A><STRONG><FONT
SIZE="+1">Löki Gale Tobin</FONT></STRONG><br/><br/><STRONG>Served
in:</STRONG><br/>Zakataqla, Azerbaijan<br /><STRONG>Years of
service:</STRONG><br/>2008 - 2010<br /><STRONG>Project:</STRONG><br/>I am a
member of the second group of youth development volunteers and in the sixth
group of volunteers to be sent to Azerbaijan. I am stationed in the
Zaqatala region, which many consider the most progressive region in
Azerbaijan(besides the capital Baku). I am currently facilitating
several college-aged English "conversation" clubs. These
clubs are promoted as English-speaking practice clubs, but allow me to
challenge participants to critical thinking, community engagement and
exposure to a diverse array of interests. Currently, many of my
conversation clubs have morphed into specific interest clubs, with one
focused on cooking, another on TOEFL preparation, and a third on
photography and graphic design (my personal hobby). <a
href="/aurora/archives/fall-2009/peace-corps/map/profiles/index.xml#tobin">More...</a><br
/><STRONG>Affiliation with UAF:</STRONG><br/>Peace Corps Master's
International student in the rural development
program<br/><STRONG>Blog:</STRONG><br/><a
href="http://farfromnome.blogspot.com">Far From Nome</a><br
/><STRONG>Video:</STRONG><br /><a
href="http://www.youtube.com/user/peacecorps#p/u/10/QU1Gtijm2iQ">A Peace
Corps Volunteer Shares How She Will Bring Skills She's Learning Home to
Alaska </a></div>')
map.addOverlay(marker);
var point = new GLatLng(41.569738,35.907483);
var marker = createMarker(point,'<div style="width:450px"><A
HREF="/aurora/archives/fall-2009/peace-corps/map/profiles/index.xml#kari"><img
src="/aurora/archives/fall-2009/peace-corps/map/bafra-class_sm.jpg"
width="304" height="201" hspace="3" vspace="0" align="right"
/></A><STRONG><FONT SIZE="+1">James
Kari</FONT></STRONG><br/><br/><STRONG>Served in:</STRONG><br/>Bafra,
Turkey<br /><STRONG>Years of service:</STRONG><br/>1966 - 1968<br
/><STRONG>Group number:</STRONG><br/>Turkey 13, teacher of English as a
foreign language<br /><STRONG>Affiliation with UAF:</STRONG><br/>Professor
Emeritus of Linguistics</div>')
map.addOverlay(marker);
var point = new GLatLng(14.165871222812834, 38.900699615478516);
var marker = createMarker(point,'<div style="width:450px"><A
HREF="/aurora/archives/fall-2009/peace-corps/map/profiles/index.xml#stichick"><img
src="/aurora/archives/fall-2009/peace-corps/map/stichick_sm.jpg"
width="304" height="201" hspace="3" vspace="0" align="right"
/></A><STRONG><FONT SIZE="+1">Michael E.
Stichick</FONT></STRONG><br/><br/><STRONG>Served in:</STRONG><br/>Adowa,
Ethiopia<br /><STRONG>Years of service:</STRONG><br/>1964 - 1966<br
/><STRONG>Group number:</STRONG><br/>Group 3, teaching and community
development<br /><STRONG>Affiliation with UAF:</STRONG><br/>NSF Summer
Institute graduate student in the M.S. teaching program</div>')
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");
}
}
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-maps-js-api-v3/-/vg2XigbDZkkJ.
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-js-api-v3?hl=en.