簡體   English   中英

Google Maps Infobox,關閉按鈕似乎不起作用

[英]Google Maps Infobox, close button does not seem to work

我正在使用Google Maps應用程序,並且使用Google的infobox插件遇到了一些麻煩。

似乎關閉按鈕不再希望在信息框上工作,這很奇怪,因為在將信息亭應用程序變成網絡應用程序之前,我確實確實可以使用它。 我為此使用了一個自定義關閉按鈕,但是即使將其切換為google的默認關閉按鈕,我也會得到相同的結果。 僅當您單擊地圖上的另一個標記以打開另一個信息框時,信息框才會關閉。 打開后,似乎無法將其刪除。 該應用程序的代碼未從信息亭更改為網絡版本...

這是一些我用來實例化標記的代碼:

var displayingInfoBox;

// Options for the infobox
var popoverOptions = {

        disableAutoPan : false,
        maxWidth : 0,
        closeBoxMargin : '8px 32px',
        closeBoxURL : 'url/to/close_button/image.png',  
        infoBoxClearance : new google.maps.Size(50,50),
        isHidden : false,
        enableEventPropagation : true,

        boxStyle: {
            border      : 'none',
            opacity     : 1.0,
            background  : "transparent url( 'url/to/background/image.png' ) no-repeat 0 0",
            width: "266px",
            height: "109px"
        }
    };

// Add listener to the marker to open the overlay -- where popupInfo is the content to display inside the popover and marker is the marker on the map
google.maps.event.addListener(marker, 'click', function( event ) {
        createOverlay( marker, popupInfo, new google.maps.Size(-35, -235))
    });

// Method to show in the overlay
function createOverlay(marker_, content_, offset_) {

    // close the previous overlay if there was one.
    VW.Map.closeInfoBox();

    // set the provided content to the popover options
    popoverOptions.content = content_;
    popoverOptions.pixelOffset = offset_;

    // use the infobox lib to create an overlay
    displayingInfoBox = new InfoBox(popoverOptions);

    // show the overlay over the marker passed in
    displayingInfoBox.open(myMap, marker_);

    // return in case the caller wants to do something with this.
    return displayingInfoBox;
}

非常感謝您提供任何幫助。

提前致謝!

編輯 -我使用的是INFOBOX API,而不是maps API中的InfoWindow對象。 這就是我正在談論的內容: http : //google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/reference.html

格雷厄姆

我有這個問題。 我使用主要的CSS樣式表來設置信息框的樣式,而不是Javascript中的boxStyle。 當我對1.0以外的任何物體進行不透明度設置(或完全刪除)時,關閉按鈕將可見,但將不起作用。 我的建議是檢查以確保您的信息框不會繼承其他任何地方的不透明度。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM