问题
I have the following code to display the info window on the google map when marker is clicked how can i add tabs to the infowindows which is using extinfowindows ,can anyone help to trace out the problem.
function createMarker(point, name, address, imagepath) {
var marker = new GMarker(point, gicons[imagepath]);
var html1 = '<span class="name-tab"><b>' + name + '</b></span> <span class="info"><br/>' + address + '</span>';
GEvent.addListener(marker, 'click', function () {
marker.openExtInfoWindow(
map, "simple_example_window", html1, {
beakOffset: -4
});
});
}
回答1:
Note:tabs are not supported for GMaps v3.0
check this
http://www.svennerberg.com/2009/02/working-with-info-windows-in-google-maps/
But we can make it for V3.0 using JQuery here is sample of code
var contentString = [
'<div id="tabs">',
'<ul>',
'<li><a href="#tab-1"><span>One</span></a></li>',
'<li><a href="#tab-2"><span>Two</span></a></li>',
'<li><a href="#tab-3"><span>Three</span></a></li>',
'</ul>',
'<div id="tab-1">',
'<p>Tab 1</p>',
'</div>',
'<div id="tab-2">',
'<p>Tab 2</p>',
'</div>',
'<div id="tab-3">',
'<p>Tab 3</p>',
'</div>',
'</div>'
].join('');
var infowindow = new google.maps.InfoWindow({
content: contentString
});
var marker = new google.maps.Marker({
position: myLatlng,
map: map
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map, marker);
$("#tabs").tabs();
});
来源:https://stackoverflow.com/questions/3994606/how-to-add-tabs-to-infowindow-which-uses-extinfowindows-for-google-map