Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/451.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加载_Javascript_Jquery_Html_Css_Google Maps - Fatal编程技术网

谷歌地图不使用javascript加载

谷歌地图不使用javascript加载,javascript,jquery,html,css,google-maps,Javascript,Jquery,Html,Css,Google Maps,我已发布我的代码,但地图未加载。请对此问题提出建议。 我也会使用谷歌地图js,但无法加载 <script src="https://maps.googleapis.com/maps/api/js?callback=initMap"> if($('.map-container:visible').length >= 0) { initMap(); } function initMap(){ go

我已发布我的代码,但地图未加载。请对此问题提出建议。 我也会使用谷歌地图js,但无法加载

<script src="https://maps.googleapis.com/maps/api/js?callback=initMap">
     if($('.map-container:visible').length >= 0) 
     {       
        initMap();
     }
    function initMap(){
        google.maps.visualRefresh = true;

      var myLatlng = new google.maps.LatLng('24.980832' ,'55.092480'); 

      var mapOptions = {
             zoom: 10, 
             center: myLatlng,
             mapTypeId : google.maps.MapTypeId.ROADMAP
        };

        var map = new google.maps.Map(document.getElementById('dubaiTradeNew'), mapOptions);

        var marker = new google.maps.Marker({
            position: myLatlng,
            map: map,
            title: 'Dubai Trade'
        });

            google.maps.event.addDomListener(window, "resize", function() { 
            var center = map.getCenter(); 
            google.maps.event.trigger(map, "resize"); 
            map.setCenter(center);  
        });   
    }

if($('.map容器:可见')。长度>=0)
{       
initMap();
}
函数initMap(){
google.maps.visualRefresh=true;
var mylatng=new google.maps.LatLng('24.980832','55.092480');
变量映射选项={
缩放:10,
中心:myLatlng,
mapTypeId:google.maps.mapTypeId.ROADMAP
};
var map=new google.maps.map(document.getElementById('dubaiTradeNew'),mapOptions);
var marker=new google.maps.marker({
职位:myLatlng,
地图:地图,
标题:“迪拜贸易”
});
google.maps.event.addDomListener(窗口,“调整大小”,函数(){
var center=map.getCenter();
google.maps.event.trigger(map,“resize”);
地图设置中心(中心);
});   
}

请尝试添加高度和宽度一次

<div class="map-container" id="dubaiTradeNew" style="height:100px;width:100px">
</div>

并设置不同的脚本

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?callback=initMap"></script>
<script>
    //Code here
</script>

//代码在这里

这是您的全部代码吗?这也是html代码,否则是的,这是我发布的全部代码。您是否遇到了任何错误,如
出现了问题
或div始终为空,没有文件。请提供一份说明您的问题的报告。