Skip to content Skip to sidebar Skip to footer

Custom Google Map V3 Controls Position Issue

I'm having an issue with three custom controls I have created for a map application. According to the API documentation: The API places controls at each position by the order of

Solution 1:

This is happening because Google Maps API needs to know the width and the height of your control elements to know where to position them - when the map is rendered. By initially setting them to display: none, you are hiding it from the actual layout of your page as well - it's as if the element's not there. Use visibility: hidden instead - setting the visibility to hidden will still hide the element on the screen, but it is still present in the layout. For reference: http://www.w3schools.com/css/css_display_visibility.asp

Also, I suggest rather than individually setting these CSS attributes to your custom control elements, add a class (you can do this via jquery's .addClass()) to these elements and toggle just by targeting the class. I've updated your jsfiddle here.

Post a Comment for "Custom Google Map V3 Controls Position Issue"