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});
}