Google Map API v3 off center if reloaded (not the usual 'resize' thing)

前端 未结 4 646
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-17 05:55

I read all the similar questions but mine is slightly different. The first time a JQuery Mobile dialog is displayed, the map loads fine inside the usual map_canvas div, but

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-17 06:21

    You don't need to create a new map each time you visit the page. Create the map beforehand, e.g. on pageinit. On pageshow: google.maps.event.trigger(mapObj, "resize");

提交回复
热议问题