using jquery accordion hides most of googleMap

五迷三道 提交于 2019-12-13 04:40:15

问题


I have an accordion widget with 2 tabs. Each of them has a GoogleMap. The first map get properly displayed but when I open the second one, only a portion of the map appears in the viewport.

If I remove the widget by commenting out the following code, both maps are properly displayed.

$("#accordion").accordion({ 
        header: "h3", fillSpace: true, event: "mouseover" 
    });

How can I use this widget while still having both map displayed properly?

Check on http://forums.asp.net/t/1780781.aspx/1?using+jquery+accordion+hides+most+of+googleMap to get the code as it is quite a job to publish it on this site.

thanks a lot!


回答1:


You'll need to observe the change-event of the accordion and trigger the resize-event for the map when it fires.

Example: http://jsfiddle.net/doktormolle/VqzPE/

The example stores the map inside the data of the accordion-content, so you may easy access it when change fires.



来源:https://stackoverflow.com/questions/9725229/using-jquery-accordion-hides-most-of-googlemap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!