Styling standard Zoom control in Google Maps v3

耗尽温柔 提交于 2019-12-24 03:53:10

问题


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 this. Any tips would be appreciated


回答1:


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


来源:https://stackoverflow.com/questions/5043419/styling-standard-zoom-control-in-google-maps-v3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!