How do I set a specific height for Google Maps?

I know the maximum width can be set using 'maxWidth', I wonder why there is no maxHeight option.

+2


source to share


3 answers


Maybe this is what you are looking for? How do I set google map markers to their maximum height?

just put the content in a div with a scrollbar:



div.infowindow {
    max-height:250px;
    overflow-y:auto;
}

      

+5


source


Actually, there is currently a maxHeight option. It is not documented, so it may be removed in a future release without warning.

maxHeight doesn't do anything useful by itself. If the content is greater than maxHeight, it just overflows. So you also need to set the undocumented autoScroll option, then the infowindow value will be capped at maxHeight and any additional content scrolled.



{maxHeight: 400, autoScroll: true}

However, this approach does not offer any advantages over Aaron's method and has the disadvantage that it will not be reliable in the future.

0


source


I recently had the same problem. I would put a custom "height" in the InfoWindow. For this I used the gm-style-iw class generated by the Google Maps Api and it works great for me. So, try adding the following to your CSS:

div.gm-style-iw {
    max-height:250px;
    overflow:scroll;
}

      

0


source







All Articles