0

Hey,

I have the following code and I am trying to get Google Maps API to add a parker to each location and thats working fine! However, I cant seem to get my tab's working in each info window?

Here is my code:

<script type="text/javascript">
var locations = [
['Jackson Building Centre',-0.4826353,52.6536]
,['Branch Bros',-0.3607193,52.76558]
,['Travis Perkins',-0.265679,52.59274]
,['B&Q',-0.2619155,52.59574]
,['Jackson Building Centre',-0.7319806,52.67846]
,['Travis Perkins',-0.733384,52.67385]
,['E H Smith',-0.2589442,52.56156]
,['Travis Perkins',-0.6792181,52.50691]
,['Jackson Building Centre',-0.674857,52.49121]
,['Travis Perkins',-0.214717,52.57708]
,['Andrews BS',-0.2089594,52.57337]
,['Buildbase',-0.540852,52.39677]
,['Buildbase',-0.166964,52.55641]
];

var map = new google.maps.Map(document.getElementById('map_canvas'), {
  zoom: 2,
  center: new google.maps.LatLng(54.21327711884562, -3.9951935000000276),
  mapTypeId: google.maps.MapTypeId.ROADMAP
});

var infowindow = new google.maps.InfoWindow();

var marker, i;

for (i = 0; i < locations.length; i++) {  
  marker = new google.maps.Marker({
    position: new google.maps.LatLng(locations[i][2], locations[i][1]),
    map: map
  });


  google.maps.event.addListener(marker, 'click', (function(marker, i) {
    return function() {

        // Create an array that will hold the tabs
        var tabs = [];
        // Create tabs and add them to the array
        tabs.push(new GInfoWindowTab('Tab 1', 'Content of tab 1'));
        tabs.push(new GInfoWindowTab('Tab 2', 'Content of tab 2'));
        // Add tabs to the InfowWindow
        marker.openInfoWindowTabsHtml(tabs);
        //infowindow.setContent(tabs);
        infowindow.open(map, marker);
    }
  })(marker, i));
}
</script>

If anyone can help me that would be grand!!
Thanks!
Dan

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by pritaeas
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.