谷歌地图小控件 [英] google map small controls

查看:125
本文介绍了谷歌地图小控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到了一张非常小的地图(180x120),但我仍然希望人们能够放大和缩小。
如何在地图上只显示+和 -



我在Gmap v3上。



谢谢

解决方案

默认情况下地图上显示的控件取决于地图的大小。但是,您可以通过地图选项

就你的情况而言,Google Maps似乎显示了180x120px地图的三个控件。您可以关闭地图类型和街景视图控件,从而将紧凑缩放控件留在后面:

  var myOptions = {
zoom:8,
center:new google.maps.LatLng(-34.397,150.644),
mapTypeId:google.maps.MapTypeId.ROADMAP,
mapTypeControl:false,
streetViewControl :false
};
map = new google.maps.Map(document.getElementById('map_canvas'),myOptions);

演示这里


I got a very small map (180x120) but I still want people to be able to zoom in and out. How to display only the + and - on the map ?

I'm on Gmap v3.

I searched and don't find anything on google map help, maybe I didn't search correctly.

Thanks

解决方案

The controls shown on the map by default depend on the size of map. However, you can turn off (or re-position or change style of) most controls through map options.

In your case, it seems like google maps show three controls for a 180x120px map. You can turn off map type and street view controls which leaves the compact zoom control behind:

var myOptions = {
    zoom: 8,
    center: new google.maps.LatLng(-34.397, 150.644),
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    mapTypeControl: false,
    streetViewControl: false
};
map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);

Demo here.

这篇关于谷歌地图小控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆