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 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});
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With