Jquery Mobile not loading Google Map (except on refresh)

前端 未结 6 1835
温柔的废话
温柔的废话 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:09

    If you navigate to this page from another page, jQM only pulls in the JS within your div[data-role="page"] tags, so if your JS is in your tags that won't be pulled in, this is what is causing your issues.

    Also yes you should use pageinit instead of pageshow, pageshow will re-fire if you navigate back to a page etc... if you have issues with a page being loaded more than once and multiple pages with the same id, there's a clever trick to use the last div[data-role="page"]

    jQuery("div:jqmData(role='page'):last").bind('pageinit', function(){


    So for a trouble free answer try this:

    map test 901

提交回复
热议问题