Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google maps google maps API v3 ZoomControl选项在移动设备上较大,不显示滑块_Google Maps_Mobile_Google Maps Api 3_Zooming - Fatal编程技术网

Google maps google maps API v3 ZoomControl选项在移动设备上较大,不显示滑块

Google maps google maps API v3 ZoomControl选项在移动设备上较大,不显示滑块,google-maps,mobile,google-maps-api-3,zooming,Google Maps,Mobile,Google Maps Api 3,Zooming,我正在为移动设备设置地图,并希望利用缩放滑块 g.map = new google.maps.Map( document.getElementById("mapcanvas"), { disableDoubleClickZoom : false, disableDefaultUI : true, scaleControl : true,

我正在为移动设备设置地图,并希望利用缩放滑块

g.map = new google.maps.Map(
        document.getElementById("mapcanvas"), 
        {
            disableDoubleClickZoom  : false,
            disableDefaultUI        : true,
            scaleControl            : true,
            panControl              : false,
            navigationControl       : true,
            mapTypeControl          : false,
            zoomControlOptions      : {
                position    : google.maps.ControlPosition.RIGHT_BOTTOM,
                style       : google.maps.ZoomControlStyle.LARGE
            },
            mapTypeControlOptions: {
                mapTypeIds          : [
                                            google.maps.MapTypeId.ROADMAP, 
                                            google.maps.MapTypeId.HYBRID
                                      ],
                style               : google.maps.MapTypeControlStyle.HORIZONTAL_BAR
            },
            zoom                    : 16,
            center                  : new google.maps.LatLng('37.8477', '-122.2627'),
            mapTypeId               : google.maps.MapTypeId.ROADMAP
        }
当我在桌面上看到这个时,控件是滑块,但在移动设备上,它仍然显示小的+和-按钮,没有滑块


这是虫子吗?如何强制滑块进行缩放?

不,这不是错误。缩放工具的默认行为是在大屏幕设备上显示大屏幕,在手机等小屏幕上显示小屏幕(仅+-)

如果希望始终使用滑块查看较大的缩放工具,则需要在mapOptions中设置google.maps.ZoomControlStyle.LARGE。例:

var mapOptions = {
    zoom: 4,
    center: new google.maps.LatLng(-33, 151),
    zoomControl: true,
    zoomControlOptions: {
        style: google.maps.ZoomControlStyle.LARGE
    }
}
以下是我的资料来源:

您可以使用整数值(即20)设置未记录的
controlSize
映射选项属性,以设置映射控件的大小

有关最新信息,请参阅@Dutchmanjonny的帖子: