开发者

Styling standard Zoom control in Google Maps v3

开发者 https://www.devze.com 2023-02-11 17:47 出处:网络
Is there an easy way to style the Zoom control in Google Maps JavaScript API v3? All what I want is just to change the standard image (http://maps.gstatic.com/intl/en_ALL/mapfiles/mapcontrols3d6.png)

Is there an easy way to style the Zoom control in Google Maps JavaScript API v3? All what I want is just to change the standard image (http://maps.gstatic.com/intl/en_ALL/mapfiles/mapcontrols3d6.png) to my one without implementing of a custom control. I tried to change it in DOM with JQuery but I cannot find the right place to do t开发者_JAVA技巧his. Any tips would be appreciated


So we came up with a solution to do the following on the tilesloaded event of Map:

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);
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号