Frank021 Frank021 - 11 days ago 7
Javascript Question

How do i create infowindow with tab

I need to create a table in infowindow to show that the first information and the second shows a photo gallery, also how do I expand the photo in table 2 in the event (on mouseover)

here is my code

var marker = new google.maps.Marker({
map: map,
position: new google.maps.LatLng(-8.759264,-63.906463),
icon: predio
});

var contentimage =
'<div style="width:470px;height:220px;margin:auto;float:left;" /div>' +
'<div>' +
'<img src="images/Sem título-2.png" width="440" height="190" />' +
'<a href="http://www.google.com.br" target="_blank">www.seusite.com.br/galeriadefotos</a>' +
'</div>';


var infowindow = new google.maps.InfoWindow({content: contentimage});

google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});

Answer

The content of an infoWindow is a DOM node like any other, for example:

var content = '<table><tr><td>1.1</td><td>1.2</td></tr><tr><td>2.1</td><td>2.2</td></tr></table>';
infoWindow.setContent(content);
infoWindow.open(map,marker);
Comments