簡體   English   中英

在Google Maps v3中樣式化標准縮放控件

[英]Styling standard Zoom control in Google Maps v3

有沒有一種簡單的方法可以在Google Maps JavaScript API v3中設置縮放控件的樣式? 我想要的只是將標准圖像( http://maps.gstatic.com/intl/en_ALL/mapfiles/mapcontrols3d6.png )更改為我的圖像,而無需實現自定義控件。 我試圖使用jQuery在DOM中進行更改,但找不到合適的位置。 任何提示將不勝感激

因此,我們提出了一個解決方案,對Maptilesloaded事件執行以下操作:

var styleZoomControl = function ()
{
    var imgs = mapCanvas.find('img[src$="mapfiles/mapcontrols3d6.png"]');

    if (imgs.length > 0 || mapCanvas.find('img[src$="mapfiles/szc3d.png"]').length > 0)
    {
        if (imgs.length > 0)
            imgs.attr('src', '/design/consumer/images/zoom-control.png');
    } else
    {
        setTimeout(styleZoomControl, 200);
    }
}

暫無
暫無

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

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