【问题标题】:Google Maps Pan and Zoom Customize Color谷歌地图平移和缩放自定义颜色
【发布时间】:2013-01-30 17:50:16
【问题描述】:

我想知道是否可以自定义平移和缩放颜色。从默认的白色到不同的颜色或添加渐变,也许。我是谷歌地图的新手,这就是我到目前为止的想法。

     function initialize() {
        var mapOptions = {
          center: new google.maps.LatLng(10.341908, 123.910602),
          zoom: 16,
          panControl: true,
          panControlOptions: {
          position: google.maps.ControlPosition.TOP_RIGHT
},


      zoomControl: true,
              zoomControlOptions: {
              style: google.maps.ZoomControlStyle.LARGE,
              position: google.maps.ControlPosition.TOP_RIGHT
    },
              mapTypeId: google.maps.MapTypeId.ROADMAP

        };
        var map = new google.maps.Map(document.getElementById("map"),
            mapOptions);

       // Creating a marker and positioning it on the map    
        var marker = new google.maps.Marker({    
            position: new google.maps.LatLng(10.341908, 123.910602),    
            map: map    
    });
      }

【问题讨论】:

    标签: css google-maps zooming customization pan


    【解决方案1】:

    map.gm-style > .gmnoprint > .gmnoprint { 把你的 CSS 放在这里}

    #map .gm-style > .gmnoprint > .gmnoprint > div > img { display: none !important;}
    
    #map .gm-style > .gmnoprint > .gmnoprint div[title="Pan up"] { put your css here}
    
    #map .gm-style > .gmnoprint > .gmnoprint div[title="Pan down"] { put your css here }
    
    #map .gm-style > .gmnoprint > .gmnoprint div[title="Pan right"] { put your css here}
    
        #map .gm-style > .gmnoprint > .gmnoprint div[title="Pan left"] {background:url(images/positionbutton_left.png) no-repeat center center !important; put your css here}
    
    #map .gm-style > .gmnoprint > .gmnoprint div[title="Zoom in"] {background:url(images/zoom_in.png) no-repeat center center !important; put your css here }
    
    #map .gm-style > .gmnoprint > .gmnoprint div[title="Zoom out"] {  put your css here }
    
            #map .gm-style > .gmnoprint > .gmnoprint div[title="Drag to zoom"] { put your css here}
            
    #map .gm-style > .gmnoprint > .gmnoprint div[title="Click to zoom"] { put your css here}
    

    【讨论】:

    • 这个答案需要澄清一下:你把 CSS 放在哪里,为什么会这样?
    • 把它放在任何 css 文件中,并在你的 mappage 中添加一个引用。
    【解决方案2】:

    没有实现这样的选项。但是控件最终只是图像(精灵),一旦地图完成加载,应该可以将它们的src更改为不同颜色的自定义图像。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-07-15
      • 2017-02-23
      • 1970-01-01
      • 2017-10-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多