Jquery Mobile not loading Google Map (except on refresh)

前端 未结 6 1941
温柔的废话
温柔的废话 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 03:21

    I would suggest using the pageinit event instead:

    From the jQuery docs:

    http://jquerymobile.com/demos/1.0.1/docs/api/events.html

    pageinit
    

    Triggered on the page being initialized, after initialization occurs. We recommend binding to this event instead of DOM ready() because this will work regardless of whether the page is loaded directly or if the content is pulled into another page as part of the Ajax navigation system.

    $( '#aboutPage' ).live( 'pageinit',function(event){
      alert( 'This page was just enhanced by jQuery Mobile!' );
    });
    

提交回复
热议问题