Google Maps Not Working in jQuery Tabs

前端 未结 13 1877
滥情空心
滥情空心 2020-12-09 22:56

Google maps not working when placed inside jQuery tabs is a question that\'s all over the web. In my research so far none of the solutions seem to work. Hopefully someone he

13条回答
  •  生来不讨喜
    2020-12-09 23:05

    This might not work for everyone! One solution that worked for me was to have the hidden tabs display but somewhere "not visible" to the user. This will allow the map to render even though is not in first/active tab. Find a way to target the hidden tabs ONLY:

    .tab-hidden{
        position: absolute !important;
        left: -10000px !important; /* maybe not that much */
        display:block !important;
        width:100% !important; /* I found this to be very important*/
    }
    

    Map width 100% and not a fixed width.

提交回复
热议问题