【问题标题】:map image is not displaying properly地图图像未正确显示
【发布时间】:2012-09-29 21:43:18
【问题描述】:

我正在使用 Google API 在我的网站中显示地图,但显示不正确。

API 链接:https://developers.google.com/maps/documentation/javascript/reference

这是我调用 google api 的代码。

var latlng = new google.maps.LatLng(latitude, longitude);
var mapOptions = {
       zoom: 6,
       center: latlng,
       mapTypeId: google.maps.MapTypeId.ROADMAP,
       zoomControl: true,
       mapTypeControl: true,
       mapMaker:true
     };
var mapInstance = new google.maps.Map(document.getElementById("map"), mapOptions);
var marker = new google.maps.Marker({
      map:mapInstance,
      draggable:true,
      animation: google.maps.Animation.DROP,
      position: latlng
});

看到一条垂直的白线来了。如何去除那条线??

【问题讨论】:

    标签: javascript api google-maps google-maps-api-3


    【解决方案1】:

    请确保您拥有完整的 DOCTYPE,例如

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    

    将 body 和 html 标签设置为 100% 高度

    <style> 
    html, body
    
    { height: 100%; width: 100%; margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px; overflow: hidden; }
    </style>
    

    出于好奇...这是在所有浏览器中显示还是仅在 IE 中显示。你能检查一下火狐吗?

    【讨论】:

    • 感谢科罗拉多州的回复...我已经更改了标签,但仍然是同一行......是的,它也在 Mozilla 中显示
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-11-02
    • 2022-01-17
    • 2014-07-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多