我正面臨以下問題。 在Google Map上,我想用選項卡添加信息窗口,其中使用GDownloadUrl方法從外部文件加載內容。代碼工作很好,但有兩個問題。 a)我第一次點擊一個標記時,沒有任何瑕疵。我需要點擊兩次以獲取信息框。之後,它工作正常。 b)當我關閉信息框並再次打開時,選項卡會重複。每當我重新打開信息框時,這些選項卡都會重複。因此,如果使用下面的代碼並打開信息框3次,我會得到6個選項卡(信息,照片,信息,照片,信息,照片)。任何想法我在這裏做錯了?谷歌地圖:openInfoWindowTabsHtml + GDownloadUrl(Ajax調用)問題
我也試過用JQuery的$ .get方法,但結果是完全一樣的。
function createREMarker(lat,long,reID)
{
var reMarker = new GMarker(rePoint,iconRE);
GEvent.addListener(reMarker, "click", function()
{
GDownloadUrl('testcontent.php?reID='+reID+'&what=info', function(data) {
content1 = data;
});
GDownloadUrl('testcontent.php?reID='+reID+'&what=photos', function(data) {
content2 = data;
});
tabs.push(new GInfoWindowTab('Info', '<div id="mapOverlayContent" style="width:375px; height:220px; overflow:auto;">'+content1+'</div>'));
tabs.push(new GInfoWindowTab('Photos', '<div id="mapOverlayContent" style="width:375px; height:220px; overflow:auto;">'+content2+'</div>'));
reMarker.openInfoWindowTabsHtml(tabs);
});
return reMarker;
};
日Thnx沒有想到使用jquery選項卡作爲一種替代的 – mspir 2010-05-24 10:50:01
FYI:所述實例在IE11打破,它示出了3點而不是製表符。 – 2014-05-07 12:51:20