在其中创建包含多个标签的InfoBox?

时间:2013-11-06 13:33:07

标签: javascript google-maps google-maps-api-3 infobox

我正在使用Infoboxes来显示GoogleMapv3上标记的信息。我想在每个标记中显示多个选项卡,但是没有找到关于如何执行此操作的任何好示例。我做标记和InfoBoxes的代码如下所示:

 //create a new marker for this coordinate
        var marker = new google.maps.Marker({
            title:title,
            content:html,
            map:map,
            draggable:false,
            position:pathCoordinates[i],
            icon: iconImg
        });

        //attach a 'click' listener to the marker and assign it a new InfoBox with related data
        google.maps.event.addListener(marker, 'click', function() {
            var infobox = new InfoBox({
                content: this.content,
                maxWidth: 150,
                pixelOffset: new google.maps.Size(-140, 0),
                zIndex: null,
                boxStyle: {
                    width: "280px"
                },
                closeBoxMargin: "8px 10px 2px 2px",
                infoBoxClearance: new google.maps.Size(1, 1)
            });
            infobox.open(map,this);
        });

1 个答案:

答案 0 :(得分:1)

您可能需要查看InfoBubble库。有关示例,请参阅here