简体   繁体   English

Gmaps.js - zoomControlOpt不会更改位置或样式

[英]Gmaps.js - zoomControlOpt doesn't change position or style

First post here on stackoverflow. 首先发布在stackoverflow上。

Trying to integrate a google map on my website using Gmaps.js ( http://hpneo.github.io/gmaps/ ). 尝试使用Gmaps.js( http://hpneo.github.io/gmaps/ )在我的网站上集成谷歌地图。 The map is working as it should, although, I'd like to make some changes to the UI. 虽然我想对UI进行一些更改,但地图仍然正常运行。

I've already disabled the default UI and only added the zoom-control, as I want to. 我已经禁用了默认用户界面,只是添加了缩放控件,正如我想的那样。

But I need to change the position of the zoom-control, and it doesn't matter what I try, nothing happens. 但我需要改变变焦控制的位置,无论我尝试什么都没关系,没有任何反应。 The zoom-control remains on default position. 变焦控制保持默认位置。 And to the real problem, so does the touch-zoom-control. 对于真正的问题,触摸变焦控制也是如此。 You see, I'm having a transparent(.png) image over a part of the map, and that image makes the touch-zoom-out button untouchable, so I will have to move it. 你看,我在地图的一部分上有一个透明(.png)图像,而且该图像使触摸缩小按钮不可触及,所以我将不得不移动它。

After some trying, I've found out that none of the zoomControlOpt objects change anything. 经过一番尝试,我发现没有任何zoomControlOpt对象会改变任何东西。

$(document).ready(function(){
            var map = new GMaps({
                div: '#map',
                lat: 60.156372,
                lng: 16.851997,
                zoom: 11,
                disableDefaultUI: true,
                zoomControl : true,
                zoomControlOpt: {
                    style : 'SMALL',
                    position: 'TOP_RIGHT'
                },
            });
            map.addMarker({
                lat: 60.140132,
                lng: 16.83658,
                open: true,
                title: 'Ingbofestivalen',
                infoWindow: {
                    content: 'Ingbofestivalen ligger på cykelavstånd från Tärnsjö. Bussförbindelser till Tärnsjö finns från Sala, Heby och Uppsala.' 
                }
            });
        });

the zoomControlOpt doesn't work because you disable the default UI, if you only want to use the zoom control you can use the code below zoomControlOpt不起作用,因为您禁用默认UI,如果您只想使用缩放控件,您可以使用下面的代码

var map = new GMaps({
            div: '#map',
            lat: 60.156372,
            lng: 16.851997,
            zoom: 11,
            zoomControl : true,
            zoomControlOpt: {
                style : 'SMALL',
                position: 'TOP_RIGHT'
            },
            panControl : false,
            streetViewControl : false,
            mapTypeControl: false,
            overviewMapControl: false
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM