Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/406.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 谷歌地图没有';jquerymobile中的t加载_Javascript_Google Maps_Jquery Mobile - Fatal编程技术网

Javascript 谷歌地图没有';jquerymobile中的t加载

Javascript 谷歌地图没有';jquerymobile中的t加载,javascript,google-maps,jquery-mobile,Javascript,Google Maps,Jquery Mobile,我不知道为什么当我尝试在我的应用程序上显示地图时,它不起作用。只是灰色,但当我在JSFIDLE上运行它时,一切都很好。我认为这是关于pageshow的,如果我将其更改为pageinit,则地图未完全加载,我已将所有高度和宽度更改为100%,但仍然未完全加载 <html lang="en"> <head> <title>Maps</title> <link rel="stylesheet" href="http://code

我不知道为什么当我尝试在我的应用程序上显示地图时,它不起作用。只是灰色,但当我在JSFIDLE上运行它时,一切都很好。我认为这是关于pageshow的,如果我将其更改为pageinit,则地图未完全加载,我已将所有高度和宽度更改为100%,但仍然未完全加载

<html lang="en">
  <head>
    <title>Maps</title>
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
    <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3&sensor=false&language=en"> </script>
    <script type="text/javascript">


        var map;

        function initialize()
        {
            map = new google.maps.Map(document.getElementById('map_canvas'), {
               zoom: 7,
               center: new google.maps.LatLng(38.0457918, 23.7676337),
               mapTypeId: google.maps.MapTypeId.ROADMAP
             });
            var currentPositionMarker = new google.maps.Marker({
                    position: new google.maps.LatLng(38.0457918, 23.7676337),
                    map: map,
                    title :"hei"
                });
        }


        $(document).on("pageshow", "#basic-map", function() {
            initialize();
        });


    </script>
</head>
<body>
    <div id="basic-map" data-role="page">
        <div data-role="header">
            <h1><a data-ajax="false" href="/">examples</h1>
        </div>
        <div data-role="content"> 
            <p>this is paragraph</p>
              <ul data-role="listview" data-inset="true" data-divider-theme="b">
                  <li data-role="list-divider">Map</li>
                  <div id="map_canvas" style="height:320px;"></div> 
                </ul>

        </div>
    </div>      
</body>
</html>

第二件事是标题标记没有出现。请帮忙。。谢谢

在触发调整大小事件后重置地图的中心位置

$( document ).bind( "pageshow", function( event, data ){
  google.maps.event.trigger(map, 'resize');
  map.setCenter(currentPositionMarker.getPosition());
});

(将
currentPositionMarker
设置为全局后,就像
map
变量一样)

您正在测试什么设备?它适用于我的Mac电脑的chrome,PC的IE,Android的chrome。。。一件事是你没有关闭
,除此之外,我觉得一切都很正常
$( document ).bind( "pageshow", function( event, data ){
  google.maps.event.trigger(map, 'resize');
  map.setCenter(currentPositionMarker.getPosition());
});