2010-04-14 62 views
16

如何將Google地圖縮放控件通過API移動到地圖的另一側?Google地圖:如何移動縮放控件?

+0

我討厭那個人,但是你[閱讀手冊](http://code.google.com/apis/maps/documentation/controls.html#Control_Positioning)? – 2010-04-14 14:16:02

回答

3

您使用的API版本2假設:

map.addControl(new GLargeMapControl3D(), new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10,10))); 

注意,如果您希望將GSize它定位。如果您還想要下來不是給出一個較高的值,以

24
var myOptions = { 
       zoom: 6, 

       zoomControl: true, 
       zoomControlOptions: { 
        style: google.maps.ZoomControlStyle.SMALL, 
        position: google.maps.ControlPosition.LEFT_CENTER 
       }, 

       scaleControl: true, 
       panControl: true, 
       navigationControl: false,    
       mapTypeId: 'roadmap', 
       streetViewControl: false, 
       center: new google.maps.LatLng(XXX,XXX) 
      } 

map = new google.maps.Map(document.getElementById('map_canvas'), myOptions); 
1

這裏我使用谷歌地圖API V3,因爲V2已被棄用

function initialize() 
    { 
    var mapProp = { 
    center: new google.maps.LatLng(51.508742,-0.120850), 
    zoom:7, 
    panControl:false, 
    zoomControl:true, 
    zoomControlOptions: { 
    style: google.maps.ZoomControlStyle.SMALL, 
    position: google.maps.ControlPosition.RIGHT 
    }, 
    mapTypeControl:false, 
    scaleControl:false, 
    streetViewControl:false, 
    overviewMapControl:false, 
    rotateControl:false,  
    mapTypeId: google.maps.MapTypeId.ROADMAP 
    }; 
    var map = new google.maps.Map(document.getElementById("googleMap"),mapProp); 
} 
-1

使用此css中的第二個參數:

.gmnoprint:nth-child(9) { left: 50%; }