admin管理员组文章数量:1318336
I have encountered a problem when using the custom google maps controls. What I want is to show the zoomControl when switching to the map and hide the zoomControl in other view using map as a static background. My code is like this,
if (isMapView) {
map.setOptions({
zoomControl: true,
zoomControlOptions: {position: google.maps.ControlPosition.RIGHT_TOP}
});
} else {
map.setOptions({
zoomControl: false
});
}
But this doesnt work, the first switch is fine and latter ones the zoomControl is disappeared. I dont know why. Could anyone give a hand?
I have encountered a problem when using the custom google maps controls. What I want is to show the zoomControl when switching to the map and hide the zoomControl in other view using map as a static background. My code is like this,
if (isMapView) {
map.setOptions({
zoomControl: true,
zoomControlOptions: {position: google.maps.ControlPosition.RIGHT_TOP}
});
} else {
map.setOptions({
zoomControl: false
});
}
But this doesnt work, the first switch is fine and latter ones the zoomControl is disappeared. I dont know why. Could anyone give a hand?
Share Improve this question edited Apr 18, 2012 at 9:46 Tschareck 4,24912 gold badges49 silver badges79 bronze badges asked Apr 18, 2012 at 7:42 Stephen NiStephen Ni 852 silver badges6 bronze badges1 Answer
Reset to default 8I am searching for this long time. But your question really helped me. I just did the same thing as you posted. It is working for me.I have added two buttons. On first button click i call DoSomething. on second, DoSomething2. It works fine. Thanks for your post. Look this, if anything helps.
function DoSomething()
{
map.setOptions({zoomControl: true, mapTypeControl: true});
}
function DoSomething2()
{
map.setOptions({zoomControl: false, mapTypeControl: false});
}
本文标签: javascriptGoogle Maps zoomControl hide and showStack Overflow
版权声明:本文标题:javascript - Google Maps zoomControl hide and show - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742043287a2417647.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论