On 23 September 2010 10:00, TC_uk <[email protected]> wrote:
>
> The code I'm footling around with looks like this:
> var tabs=[];
> for (var i = 0; i < content2.length; i++)
> var title = [ "info" , "details" ] ;
> var text = [ html , "<div class=\"address_lines\">" + content2 + "<\/
> div>"] ;
> tabs.push(new GInfoWindowTab(title,text));
> map.openInfoWindowTabs(tabs);
> ...But this doesn't work of course!
>
> If I'm close, please correct me. If I'm miles away, ignore me and I'll
> hang my head in shame!
Examine what this does. You create two arrays, and then attempt to put
those *arrays* into GInfoWindowTab().
But what you should be doing is creating an array of GInfoWindowTab()
objects, each of which has its own title and content.
In your createTabbedMarker function, I'm going to assume that you want
the first tab to contain "name" as its header and "html" as its
content; and "title" and "content2" for the second tab, if they exist.
Change things around if you like: the important thing is that each Tab
has *one* item as tab-text and *one* item as its content.
var tabs = [];
var tab1 = new GInfoWindowTab(name,html);
// could be for example
// var tab1 = new GInfoWindowTab("info",name+"<br>"+html);
tabs.push(tab1);
if (content2) {
var tab2 = new GInfoWindowTab(title,content2);
tabs.push(tab2);
}
// tabs is now an array of Tab objects
// that array always has at least one element, and might
// have a second if it's been supplied.
// ... more stuff here to create the marker and event handlers
// Pass your array to create a tabbed infoWindow:
marker.openInfoWindowTabs(tabs);
--
You received this message because you are subscribed to the Google Groups
"Google Maps API V2" 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.