Google マップ API v3 と InfoBubbles プラグインを使用しています。マップに複数のマーカーを設定しようとしています。各マーカーには、クリックすると開く InfoBubble があります。これらの InfoBubbless には、それぞれ独自のコンテンツと html を持つタブ (最大 3 つのタブ) があります。
タブとインフォバブルを使用してマップにマーカーを表示するにはどうすればよいですか。
現在、インデックスを渡しながら、infobubbles とマーカーを配列に設定し、パブリック関数を使用してクリックを処理しています。
infoBubbles[i] = new InfoBubble({
map: map,
minHeight: point[i].min_height,
maxHeight: point[i].max_height,
minWidth: point[i].min_width,
maxWidth: point[i].max_width,
disableAutoPan: false,
hideCloseButton: false,
arrowPosition: 30,
padding:12
});
google.maps.event.addListener(marker, 'click', handleMarkerClick(marker, i));
およびマーカークリック機能:
function handleMarkerClick(marker,index) {
return function() {
if (!infoBubbles[index].isOpen()) {
infoBubbles[index].open(map, marker);
}else{
infoBubbles[index].close(map, marker);
}
}
}