Google Maps SVG marker doesn't display on IE 11

前端 未结 5 1474
星月不相逢
星月不相逢 2020-12-08 02:06

My SVG map marker disappears on IE11. It\'s visible in Chrome, Firefox, Safari, IE9 & 10, but not 11. I\'ve uploaded a JSfiddle of my current code. I can\'t tell if this

5条回答
  •  旧巷少年郎
    2020-12-08 02:55

    I had a very similar issue for a project, but I was in a situation where I couldn't edit the GM javascript.

    So, here is a CSS approach I'd like to share:

    #someGoogleMapsWrapperHere .gm-style img[src$='.svg'] {
        width: 48px !important;
        height: 48px !important;
    }
    

    This only selects img elements which have a src attribute value that ends with '.svg' inside your GM integration and forces them to use the width and height of 48px.

    I usually try to avoid those !important tags - but in this case it was mandatory, because it has to overrule some inline styles that define a width and height of 0px in IE11.

提交回复
热议问题