Google地图 – 不显示,但以HTML格式加载

我不知道为什么会这样。

但出于某种原因,我的谷歌地图脚本已加载到页面中,但不会显示。

我很好奇我做错了什么。

这是我的HTML。

  • Titel:
    Text
  • Titel:Text

这是我的Javascript(使用jQuery):

  $(document).ready(function(){ var coll_gmap = $(".gmap"); if ( coll_gmap.length != 0 ) { //initiate map geocoder = new google.maps.Geocoder(); var latlng = new google.maps.LatLng(-34.397, 150.644); var myOptions = { zoom: 8, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP } //loop all addressen + insert into map coll_gmap.each(function(index) { map = new google.maps.Map(coll_gmap[0], myOptions); if (geocoder) { geocoder.geocode( { 'address': $(this).attr("address")}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location }); } else { alert("Geocode was not successful for the following reason: " + status); }//end if status }); //end if geocoder.geocode } //end if geocoder }) //end coll_gmap each }//end if coll_gmap length }); //end onload var geocoder, map; 

我发现它是什么。

我必须设置我的宽度和高度

 
=>(becomes)=>

很容易忘记,我猜:(

破碎的HTML。 没有你的div被关闭,这完全错了: