Hide custom controls on map?

1,128 views
Skip to first unread message

Sammy

unread,
Jun 18, 2011, 11:47:41 AM6/18/11
to Google Maps JavaScript API v3
Hi
I have created some buttons on my map with the following code:
map.controls[google.maps.ControlPosition.RIGHT_TOP].push(oButton);
How can I hide this control, and show it again?

I did the following, but this deletes the button from the map:
oEl = document.getElementById('btnPathLength');
if (oEl && oEl.parentNode) oEl.parentNode.removeChild(oEl);

Thank you for tips.

Sammy

unread,
Jun 18, 2011, 12:03:56 PM6/18/11
to Google Maps JavaScript API v3
Sorry, I think I found a way already. I've been trying with this and
it never worked
if (oEl) oEl.display = 'none';

and then found out that I need "style", the one below works:
if (oEl) oEl.style.display = 'none';
Reply all
Reply to author
Forward
0 new messages