Jquery Mobile not loading Google Map (except on refresh)

前端 未结 6 1826
温柔的废话
温柔的废话 2021-02-06 02:52

I\'m using Jquery Mobile 1.0 and Google Maps v3 to load a user location map. The map loads fine when accessed via direct url but when accessed from a link, it chokes up and not

6条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-06 02:58

    Interesting, I need to use "pageshow" rather than "pageinit" when navigating from another page.

    When using "pageinit", the on function is run, but the callback function to draw the map is not. When using "pageshow" as in $( document ).on( "pageshow", "#map-page", function() {, then the callback draw map is run just fine by jQuery.

    So, while I would prefer to use "pageinit", that just doesn't work for me.

提交回复
热议问题