4

我的谷歌地图实例中的信息窗口看起来很有趣:缺少背景图像的信息窗口

构成信息窗口图形角落和末端的某些图像似乎丢失了。知道为什么会这样吗?我正在尝试,但还没有弄清楚。

我正在使用gmap3,一个用于谷歌 V3 API 的 JQuery 包装器。这是我设置地图的代码(javascript/haml):

  <script>


$(window).load(function() {
  $('#map').gmap3();
  var bounds = new google.maps.LatLngBounds ();
  -@areas.each do |area|
    bounds.extend(new google.maps.LatLng(#{area.latitude}, #{area.longitude}));
    $('#map').gmap3(
    {
    action:'addMarker',
    latLng:[#{area.latitude},#{area.longitude}],
    events:{click:function(marker, event){
    $(this).gmap3({action:'clear',list:['infoWindow']});
    $(this).gmap3(
    {
    action:'addInfoWindow',
    latLng:marker.getPosition(),
    infowindow:
    {content:"#{escape_javascript(link_to area.name, area)}<br>#{escape_javascript(image_tag area.image_holder.image.url(:thumb)) if area.image_holder.present?}"}
    }
    )}}
    }
    );
  $('#map').gmap3('get').fitBounds(bounds);
  $('.clickable_row').click(function() {
  var id = $(this).attr('id');
  window.location = '#{areas_path}' + '/' + id;
  });
  });
  </script>
4

4 回答 4

11

我已经看到这是由覆盖地图的最大宽度规则引起的。尝试设置这个:

#map img { max-width: none; } 
于 2011-08-20T04:21:21.513 回答
0

我认为这与您的连接带宽低有关。我认为角落的图像超时。每次都发生这种情况吗?您的连接有问题吗?尝试使用 firebug 查看网络流量并发现图像请求以及它们是否超时。

于 2011-05-24T06:59:32.613 回答
0

我不知道是什么导致了这个问题,但它不再发生。那时我仍然熟悉将 javascript 和 google 地图集成到我的 rails 应用程序中,所以也许我搞砸了一些设置或 js 包含。谁知道。

把它归结为我的笨拙。

于 2011-10-06T15:15:23.990 回答
0

有同样的问题,

只需将此代码放入您的 css 文件中:

img[src*="gstatic.com/"], img[src*="googleapis.com/"]  {
max-width: 99999px;

}

于 2013-08-30T10:24:27.493 回答