Google Maps zoom control is messed up

前端 未结 9 1126
旧时难觅i
旧时难觅i 2020-12-07 23:46

I use the Google Maps API (v.3) to show a map with a couple of markers. I recently noticed that the control used to zoom the map is messed up (it wasn\'t always like this).

相关标签:
9条回答
  • 2020-12-08 00:26

    Just share @Max-Favilli answer:

    With latest version of google maps api you need this:

    <style>
    .gm-style img { max-width: none; }
    .gm-style label { width: auto; display: inline; }
    </style>
    

    Thanks to @Max-Favilli

    https://stackoverflow.com/a/19339767/3070027

    0 讨论(0)
  • 2020-12-08 00:31

    Those options you guys told me didn´t work for my website.

    I use Bootstrap V3 and focussed on the functionality. The main reason was that i had given my map a different ID then the CSS file used to display the zoom bar with the yellow streetvieuw guy

    I renamed map_canvas to mapholder and then it worked for me! Thanks anyways for the hints that i should look into the CSS files!

    0 讨论(0)
  • 2020-12-08 00:34
    #myMap_canvas img {
        max-width: none;
    }
    

    fixed it for me, but I also wanted to point out the comment on the question by @Ben, "This issue doesn't happen with Bootstrap if you use the is map_canvas as the map div id". He's right. I'm not using Bootstrap, but the problem started happening after I changed the div id.

    Setting it back to map_canvas fixed it without the max-width change.

    <div id="map_canvas"></div>
    
    0 讨论(0)
提交回复
热议问题